managed wordpress hosting

Moving WordPress to new Domain and forwarding permalinks


On 05-17-2014 articles, wordpress

How to forward your permalinks under a new domain when using WordPress

You have decided to re-brand your domain. You have been using WordPress for several years and have tons of blogs, and quite a bit of pages. What is the best way to keep the same permalink structure and just redirect the root domain to retain all your links out there on the web.

If you are using a hosting company that has Cpanel, this is very, very easy! First you log into your Cpanel, then go to Redirects (it could say use the work Forwarding).

forward-domains

 

Now you choose the domain you want to redirect from the drop down. Type in the redirect to, make sure you include the http:// part. Pick the with or without www, this will redirect the domain for both versions if someone types in www or no www. And this final trick here is to check the Wild Card Redirect! This is what will keep your permalinks redirecting to the new domain. Of course all this does is write the code for you in the htaccess file, just take a look at your htaccess file and you will see it wrote the code for you and is now handling your redirects in the way to retain all links from your old to your new domain.

301 redirect with wildcard

 

If you don’t have access to a Cpanel, then you can actually drop in this code in your htaccess file for the domain you want to forward. Note the hosting account needs to be active in order for this to work, so you need to have nameservers and dns still pointing to your old domain, that way when someone types in your old domain it reads the htaccess file and does a 301 redirect to your new domain.

RewriteEngine on

RewriteCond %{HTTP_HOST} ^old-domain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.old-domain\.com$
RewriteRule ^(.*)$ "http\:\/\/www\.new-domain\.com\/$1" [R=301,L]