Here’s How to Redirect Your Old Website to a New One

Redirect Old Website to New

We won’t dive into the details as to why you would to redirect your old website to a new one as that is subject to whole discussion of itself so we will just go right into the topic at hand.

Redirecting an old website to a new one brings about challenges generally related to SEO (Search Engine Optimization) and downtime but if things are done properly then there should be no downtime or SEO issues at all.

So you would want to make sure that a web address like:

https://www.oldwebsite.com/more-stuff-here/

Properly redirects to its new equivalent like so:

https://www.newwebsite.com/more-stuff-here/

The first step is you would need to set up the new domain name or website and have it configured to point to the document root of your current website or the location where the new website will be running from. This will be done at the domain level and on your web server the appropriate configurations will have to be done.

Redirect an Old Website to a New One in Linux with Apache

For Apache web server the following code will have to be placed in the .htaccess file in the document root of the old website changing the names of the websites as needed.

Read Also  All Geared up for QtCon 2016


RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.oldwebsite.com$
RewriteRule (.*)$ http://www.newwebsite.com/$1 [R=301,L]

The code above will be executed by the web server whenever there is a request to it. The code will basically ensure a request has been made to the old domain name. If that is the case then the request will be redirected to the URI but now under the new domain name.

It is important to perform the check for the old domain to avoid issues of double redirects which would occur without it. It is also important to note that the Apache ModRewrite module needs to be enabled. The code will perform a check and perform the redirect only if the module is active.

Using Nginx to Redirect Website

Open the nginx.conf file and add the following code to it changing the oldwebsite.com and newwebsite.com as needed:

server {
listen 80;
server_name oldwebsite.com;
return 301 $scheme://newwebsite.com$request_uri;
}

Redirect an Old Website to a New One on a Windows Server

Unless you are the server administrator then you will have to make a request to have it done for you through the “Internet Services Manager” interface. Generally the process is simple and it uses a GUI (Graphical User Interface).

Read Also  How to Allow Multiple File Uploads in HTML Forms

You start by accessing the “Properties” > “Home Directory” of the website you want to redirect. Next you will need to acces the “Default Web Site Properties” dialog. You will the need to Select “A redirection to a URL“. Thereafter in the “Redirect to:” field type in the new web address.

Next select “A permanent redirection for this source” then press the Ok button for finish.