There are domains old.test.ru and test.ru. How do I redirect all pages from old.test.ru/* to test.ru/*?
I have these .htaccess:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
# redirect from index.(php|asp|aspx|html|htm), main.(php|asp|aspx|html|htm), home.(php|asp|aspx|html|htm)
RewriteRule ^(.*)index\.(php|asp|aspx|html|htm)$ $1 [R=301,L]
RewriteRule ^(.*)main\.(php|asp|aspx|html|htm)$ $1 [R=301,L]
RewriteRule ^(.*)home\.(php|asp|aspx|html|htm)$ $1 [R=301,L]
# redirect from dev and www
RewriteCond %{HTTP_HOST} ^old\.test\.ru$ [OR]
RewriteCond %{HTTP_HOST} ^www\.test\.ru$
RewriteRule ^(.*)$ http://test\.ru/$1 [R=301,NC]
</IfModule>
I think that last line
RewriteRule ^(.*)$ http://test\.ru/$1 [R=301,NC]
should work, but it doesn't.
It works for:
old.test.ru/about.php -> test.ru/about.php
old.test.ru/company.php -> test.ru/company.php
old.test.ru/contact.php -> test.ru/contact.php
But didn't work for:
old.test.ru/some/about.php -> test.ru/some/about.php
old.test.ru/some1/company.php -> test.ru/some1/company.php
old.test.ru/some2/contact.php -> test.ru/some2/contact.php
old.test.ru/some2/subsome/contact.php -> test.ru/some2/subsome/contact.php
What should I change?