Answer the question
In order to leave comments, you need to log in
How to redirect part of url?
Hello! Some keywords in the URL have changed a bit on the site and we need to redirect from old links to new ones.
Example:
http://example.org/category/ -> http://example.org/categoria/
http://example.org/category/product/ -> http://example.org/categoria/tovar/
http://example.org/info/ -> http://example.org/informatcia/
RewriteRule ^category /categoria [L]
RewriteRule ^category/(.*) categoria[L]
Answer the question
In order to leave comments, you need to log in
RewriteEngine on
RewriteRule ^category$ /categoria [R=301,L]
RewriteRule ^category/product$ /categoria/tovar [R=301,L]
RewriteRule ^info$ /informatcia [R=301]
RewriteEngine On
RewriteBase /
## Два выражения выше уже должны быть в идеале ##
## Обычные 301е редиректы на категории
Redirect 301 /category/ http://domen.dom/categoria/
Redirect 301 /info/ http://domen.dom/informatcia/
## Редирект на все товары подкатегории
## Работает в случае, если categoria находится в корне (http://domen.dom/categoria/)
RewriteCond %{REQUEST_URI} ^(.*)(\/category\/)(\S+)$
RewriteRule ^(.*)$ categoria\/%3 [R=301,L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question