Blogging Talk Tips & Tricks

Easy htacess Redirect Code

I’ve moved websites several dozen times already. And usually they are WordPress blog sites and on same domains. So its simply a server/host move.  And I didn’t have to be bothered to learn about redirects for changed URL’s. For me, these has become even something like a routine.

But, its a bit of a different story when it comes to moving a site to another domain name. I’ve only done this a few times. And aside from the actual moving of the site to where you are hosting the new domain, you also have to make sure that your old domain redirects to the new domain.

Of course, you don’t want to lose traffic right? I am also of belief that this helps in search engine indexing. I’ve also realized that the usual 301 redirects found on cpanels works on the main url but on sub posts/pages it often does not. So I had to dig in for more .htaccess code to use to ensure that all my old url’s would redirect to the new url’s. This is specially crucial for blogs with hundreds if not thousands of pages. You won’t want to leave leaving your readers searching in a huge pile if you just redirect to the main URL.

I found this code works really best:

RewriteEngine on
RewriteRule ^(.*)$ http:/newdomain.com/$1 [R=301,L]

It would redirect every single old URL to the exact new URL, so everything would be seamlessly redirected for your readers. You just need to navigate to where your .htaccess file is on your old domain (if you don’t have one, then just create one), then paste above code, then save.

Leave a Reply

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

Pin It on Pinterest

Share This