Have you ever needed to move your website to a new domain? This can be a tricky thing to do without breaking all the links to your website that exist in emails, print media, Facebook, or anywhere else on the internet. It is possible to redirect all incoming links with a piece of .htaccess code that will keep all your old links working.
.htaccess Code
RewriteEngine On RewriteBase / # New code to redirect from olddomain.com to newdomain.com # Permanent redirect for caching purposes, also include the query string RewriteCond %{HTTP_HOST} ^olddomain.com RewriteRule (.*) http://newdomain.com/$1 [R=permanent,QSA,L] # New code to redirect from www.olddomain.com to www.newdomain.com RewriteCond %{HTTP_HOST} ^www.olddomain.com RewriteRule (.*) http://www.newdomain.com/$1 [R=permanent,QSA,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]
Note:
Replace olddomain.com with your old domain name, and newdomain.com with your new domain name. This will redirect all links that go to your old domain to your new domain.
Link Examples
http://blocksagencies.ca/insurance-tips/faq/
Takes you too
http://blocksagencies.ca/insurance-tips/faq/
http://blocksagencies.ca/contact-us/
Takes you too
http://blocksagencies.ca/contact-us/
Pingback: GossenInsurance.ca is now BlocksAgencies.ca — MennoSites - WordPress Consulting()