Answer the question
In order to leave comments, you need to log in
Redirect for specific links. Problem with RewriteRule
Hello.
I ask you to help with the correct formulation of the condition in .htaccess.
In a nutshell :
The site mysite.ru (Site 1) had its domain name changed to http://old.mysite.ru, and the name mysite.ru was assigned to a new site (Site 2).
Part of the materials from Site 1 was not transferred to Site 2, and the task is to ensure that these materials indexed by search engines with links like " http://mysite.ru/content/view/any_integer_number/11/ " open, but, of course, already on links like " http://old.mysite.ru/content/view/any_integer_number/11/ "
At the root of Site 2 in .htaccess I write:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mysite\.ru\/content\/view\/([0-9]+)\/11\/$ [NC]
RewriteRule ^(.*)$ http://old.mysite.ru/content/view/$1/11/ [L]
Answer the question
In order to leave comments, you need to log in
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mysite\.ru$ [NC]
RewriteRule ^(.*)$ old.mysite.ru/$1 [R=301,L]
Redirect from mysite.ru to old.mysite. ru. If the first two lines are uncommented, then they do not need to be written again.
Get the working code.
RewriteEngine On
RewriteCond %{REQUEST_URI} /content/view/([0-9]+)/11/$ [NC]
RewriteRule ^(.*) http://old.mysite.ru/$1 [R=301,L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question