How to redirect old website url to new url including page links

The situation is that you have an old domain with a website or even various websites and sub-domains. You have moved all your files to another server or web address but you don’t want to lose the traffic from all the people who have bookmarked or link to you.

You want to lead to

In fact, you want ALL old links to go to the exact same place on the new server. This is how you redirect everything all in one go permanently with the htaccess file.

Creat a .htaccess file (don’t forget the DOT before it, it’s hidden from public view)

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^ [nc]
rewriterule ^(.*)$$1 [r=301,nc]

Upload it to the root of your website, usually where your index.html or index.php files are and you are all set. Google some of your old links and see where they take you. It should be to the same page on the new website.

One thing to remember is this will only work on a Linux Apache webserver which allows the Mod Rewrite function.

PS: If you are on a Windows Server, try Googling the html redirect method.

That’s it, now all incoming links from any of the old posts/pages will be forwarded to the new site 🙂


4 thoughts on “How to redirect old website url to new url including page links

  1. No biggie Phil, just something I Googled. As LxH is closing we have all moved our blogs and other sites, and I wanted all links to be followed, not just a redirect to the new root domain. Incidentally, could you change the url for this blog on Crunchbang Planet?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s