I have changed domain on the Magento store, however I need to still keep old domain urls accessible and redirected to new domain urls.
for example.
old-domain.com/products should redirect to new-domain.com/products
This is from my current htaccess
Options +FollowSymLinks
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]
RewriteCond %{HTTP_HOST} ^old-domain\.com$ [NC]
RewriteRule ^(.*)$ http://new-domain.com/$1 [R=301,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
as you can see, I tried 2 versions,
RewriteCond %{HTTP_HOST} ^old-domain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.old-domain\.com$
RewriteRule (.*)$ http://www.new-domain.com/$1 [R=301,L]
and
RewriteCond %{HTTP_HOST} ^old-domain\.com$ [NC]
RewriteRule ^(.*)$ http://new-domain.com/$1 [R=301,L]
But none of them work.
Yes, I have disabled caching in Magento and yes, just in any case, I still flush the cache in Magento and I clear cache in browser too.
I dont know if this matters but anyways.
Both new and old domains are controlled by godaddy, with its default nameservers, and both domains have @ record pointed to my server IP address.
Please help : )
Note: of course, I have real domains in the htaccess instead of old-domain.com and new-domain.com
Currently any kind of url with old domain, just redirects to homepage of new domain.
Best Answer
Let's try this one:
https://mediatemple.net/community/products/dv/204643270/using-htaccess-rewrite-rules
should be useful. Have you enabled mod_rewrite?
Oh I found reason why it didn't works for You. Please try something like:
EDIT:
here are parameters You can use: