How To Redirect Website Pages To A New Domain

redirect website
Redirect Website Pages

How do you redirect website pages from your old domain to your new domain? Sooner or later, many website owners run into this situation… you have an established website and want to change to a new domain name.

Your dilemma is this: You want to redirect all existing web pages to the equivalent pages on the new website, even if there are hundreds of pages in your existing website. Furthermore, you want to let the search engines know about the change and not lose any page rank.

The good news is that this can be done, and it isn’t near as much work as you may think!

I had this situation a while ago, and here is how I did it…

Basic Scenario

My client had a website with domain name, for illustration, olddomain.com, and wanted to change it to, also for illustration, newdomain.com. The was a WordPress website that already had about 20 established web pages. I wanted to make sure that every page on olddomain.com properly redirected to the same named page on newdomain.com.

The Plan

As I mentioned, this was a WordPress website, so the steps below take that into account.

One major problem that anyone faces when changing a website domain name, is that all references to local website resources, like images or internal links, will also have to be changed.

Here are the steps:

  1. Log into your website host CPanel. Buy the new domain name if you haven’t already done so. Point that new domain name to the same root location as your old domain name. Note: There is a delay of up to 24 hours for a new domain name to become known throughout the Internet. If you haven’t bought the new domain name earlier, you may have to wait a few hours before proceeding.
  2. Log into WordPress Admin using your old domain name. Install a plugin like Velvet Blues Update URLs to change the URLs of all images and internal links to your new domain name. Also go to Settings -> General and make sure that your WordPress Address and Site Address point to your new domain name. At this point, your website should be able to work properly with your new domain name.
  3. The final step in this process is to redirect website pages from your old domain to the equivalent pages on your new domain.

Redirect Website Pages With Htaccess

301 Redirect

With this last step, you will be doing a “301 redirect” on all pages on your old domain name. This is an extremely useful method of redirection that tells the search engines, “this page has permanently moved to the new location.” This type of redirect also takes all page rank that you have built up with search engines to the new page location.

.htaccess

In the root folder of most websites is a file named .htaccess. It is used to issue instructions to the Apache web server that so many websites run on.

Implement The Website Redirect

Here is how to properly redirect website pages to a new domain name:

  1. Create a new folder under the root of your web server. If your old domain was olddomain.com, it probably makes sense to name that folder olddomain.
  2. Create a new file named .htaccess and put the following code in there:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.olddomain.com$
    RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]
    </IfModule>

    In this code, replace olddomain.com with your actual old domain, and newdomain.com with your actual new domain.

  3. Place this .htaccess file into the folder that your created in step 1.
  4. Log into you website CPanel, go to the Domain Manager, and point your old domain name to the folder that you created in step 1. (That folder becomes the root folder for your old domain name.)

At this point, your web server will properly redirect website pages from your old domain to your new domain. It worked well for my client’s website.

PS. Have you tried this method, or perhaps another method to redirect website pages to a new domain? Let us know in the comments…

>