Answer the question
In order to leave comments, you need to log in
How can I correctly write a RewriteRule for such a condition?
There is an ulr like site.ru/tovar/semena-ovoschey/semena-arbuza/vostochnyj-ornament. How can I correctly write the RewriteRule to get site.ru/semena-ovoschey/semena-arbuza/vostochnyj-ornament?
Tried like this:
RewriteRule ^product/(.*)$ $1 [R=301, L]
But this rule doesn't work!
Answer the question
In order to leave comments, you need to log in
You have a cyclic request.
Because redirects will work again and again until after passing through .htaccess, no url changes.
In your case, you need to set the first condition more strictly.
like this
RewriteCond %{REQUEST_URI} !^semena-ovoschey.*$
RewriteCond %{REQUEST_URI} ^tovar/(.*)$
RewriteRule ^tovar/(.*)$ $1 [R=301, L]
Eugene, try looking for the answer here: blog.aweb.ua/301-redirect
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question