I am trying to redirect an old website to a new website.
The DNS records for the old website are on one server. The new website is on another server at another hosting provider.
The DNS records for the old website have been updated to point the domain to the IP address of the new website. This works as expected and now oldwebsite.com points to newwebsite.com.
The problem is that I’m trying to add internal page 301 redirects from the old website to the new website on the new website’s hosting and the redirects are not working.
For instance, I’ve added the following to my htaccess file in the new website’s root folder:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^oldwebsite.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.oldwebsite.com$
RewriteRule /locations https://newwebsite.com/about/locations/
Instead of redirecting oldwebsite.com/locations to https://newwebsite.com/about/locations/, it just goes from oldwebsite.com/locations to newwebsite.com.
In other words, it’s just redirecting the /locations URL to the root of the folder.
What am I missing?
1