Maintain SEO when Changing Domain or Page Names

How a 301 domain redirect can save your site’s SEO ranking



This question of losing search engine ranking because of moving pages has come up a few times and unfortunately it is usually after they have switched domains and their site has tanked. It is much better to plan ahead but all is not lost if you have already pulled the trigger.

Changing Domain Versus Changing Page Names or Subdomains

Changing Site directory, file names or subdomains

The first time I came across this issue was with a company who had switched their site from old static pages to a CMS solution (WordPress). This had been a long time coming but there was a lot of old static content that had been ranking quite well in the search engines. As soon as the content had been switched over, the new site worked great. BUT, suddenly the traffic died, the rankings dropped, and the designers turned to me and asked what went wrong.

What had happened is that the filenames had changed.  Using our own domain as an example, had changed to The new CMS had added a new directory to organize all the articles together in the same spot. Suddenly in the eyes of the search engines this all became new content as they had not been told that it had moved. A couple of other ways that this can go wrong are:

  • Changing file names or extensions – As an example: dave.html changed to dave.asp or dave.html turned to davearticle.html
  • Changing to subdomains – As an example: changes to

The short answer is if you change ANYTHING within your domain structure you will have problems with all of the Search Engines.

Transferring an entire Site to a New Domain

Shortly after the previous situation I got a question from someone who had recently bought the .com for his domain and wanted to go from to To the search engine this may as well be to Now in this situation they were transferring an entire site to a new domain, with the same site structure, which is actually easier then the above. However, sometimes you are switching domains and switching site structure which can be a nightmare.  I’ll cover this later but first….

STOP NOW AND THINK! Why are you doing either of these things?

Before I get into how you can mitigate the problems with changing site structures, I want you to think hard about WHY you are changing your domain name or changing file structure. If the answer is that it is essential for the site’s SEO efforts, needed for branding, or changing to a CMS then those could be good points but otherwise DON’T DO IT. I will try my best to explain how I have done this in the past but even following this advice you will probably still lose traffic and it may take a long time to climb back to the top of the search rankings. So be warned that changing any part of your domain is risky business and few come out on the other end without some bruises. So with that warning lets continue….

What are .htaccess files and 301 redirects?

These two things are your friends when it comes to switching URLs and will be covered in general terms, so you should read up in more detail if you are going to do this yourself.

An .htaccess file is a file that tells browsers, Search Engines and Spiders, and anything else crawling your site what to do with your pages. There are lots of ways to use the .htaccess file but we will be using it to move visitors from your old site/page to the new domain/pages. If you want to learn more please check out this basic htacess tutorial .

301 Redirects, on the other hand, are used to tell visitors to your site that your page has permanently moved. There are a lot of codes your browser gets back from sites, if the page is missing you will get a 404 Page Error. A lot more codes exist and if you want to see them all check them out here.

Combining .htaccess files and 301 redirects

I am going to use the above example where I have changed to ptccomputersolutions/articles/dave.html.

Redirecting an old page to a new one in .htaccess file

First I log into my server and open up the .htaccess file in my main directory. This can be done with a simple text editor and ftp client. For a text editor that makes this process even easier you can check out Ultraedit. Their editor has an FTP client built in as well as a lot of other functions.

If the .htaccess file is not there then you will need to create it by uploading a file called .htaccess to the main directory. Make sure to use a text editor that doesn’t add .txt or something else to the end (Notepad is good, Microsoft word is bad). So, in Notepad, click Save As… and type .htaccess with Save As Type set to All Files. If there is already an .htaccess file on your server don’t forget to Save or Back it up somewhere safe before manipulating it!

Now in the file you need to add the following line or add it to the end on its own line if the file already has code in it:

  • Redirect 301 /dave.html
  • Redirect 301 /youroldpage.html

So here we are telling any visitor to the site that we have permanently moved the dave.html file. Note we do not put the whole site address just /dave.html, as it was in the root directory but if it was elsewhere, it could be /article/published/dave.html. We then write out the entire new address where the new page resides. This could be on the same domain but you could also point them to a new domain. That is it for one little page change but let us look at a couple of examples and some shortcuts for more complex problems.

Back to our 2 problems

Changing page names without losing your rank

The first problem was changing the directory/naming structure of your site. In this case, if it was only one page then the above would work. If you have moved a lot of content all around then you will need to tell Spiders where to find each new page. So within your .htaccess file you would have something like:

  • Redirect 301 /dave.html
  • Redirect 301 /ashley.html
  • Redirect 301 /oldarchive/seo.html

As you can see each page will need its own line in the .htaccess. Is this a pain? Yes, but so is losing rankings and waiting for the Spiders to re-index your content. One shortcut is that if you are moving to a new directory where all the files are the same you can use just one line so if we had (take note that these should all be on 1 line in the .htaccess file instead of the 2 lines shown here):

  • Redirect 301 /oldarchive/seo.html
  • Redirect 301 /oldarchive/ppc.html
  • Redirect 301 /oldarchive/search.html

We could combine this into one line:

  • Redirect 301 /oldarchive/

One warning, make sure all your file names are the same so if you have seo.html and it changes to awesomeseo.html write out each line instead of the above.

Changing domain without losing rank

So, what about when we are switching from to Well, if we are keeping the EXACT same directory structure then we can use the same technique as above, so our .htaccess file on would have the line:

  • Redirect 301 /

This tells Visitors and Spiders that the entire site has moved. If a Visitor now went to they would be redirected to A small warning is to make sure you move all pages over because if a page existed on your old site and not on the new one then they will be directed to a non-existing page and get a 404 Error which actually hurts the SEO Ranking.

Quick Note On Changing Links

I just wanted to throw in the point that if you are changing your whole site you should approach all the people who are linking to you and try to get them to link directly to the new page. A 301 Redirect should still give you some of the link juice but it’s always better to have a direct link to the new page.

Testing Your 301 Redirects

It’s always a good idea to check to make sure your .htaccess file and 301 redirects are working. You can simply go to the page and see if you redirect but if you are feeling paranoid then you can take a look at the header file. Firefox has made it easy by offering a free App you can grab here. What this app does is let you look at all the technical information coming to your browser.

This tool is going to give you a lot of information that you don’t need. The information you need will be near the top. Between each set of lines will be a different server request and depending on what you have added on your browser there will be a bunch of useless stuff. What you want to do is look between each set of lines and at the top you’ll find the request. So here is one I made on my business site to redirect over here. As you see the first part you can ignore but after the blank line you see HTTP/1.x 301 Moved Permanently. This is what we were looking for and a few lines below we see it is redirecting to my blog.


GET /301redirect.html HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Tue, 19 Dec 2016 22:16:50 GMT
Server: Apache
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 248
Keep-Alive: timeout=2, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1


So that’s it….well except for you window server guys. All I can say about that is that it is the same process and you should use 301 Redirects. Unfortunately I have never done it so I am not going to give advice on the code but it should be similar.

Be Sociable, Share!

Leave a comment

Your email address will not be published. Required fields are marked *

* Copy This Password *

* Type Or Paste Password Here *