Answer the question
In order to leave comments, you need to log in
How to compose a regular expression for a subcategory URL?
How to correctly write regular expressions for htaccess to open
site.ru/categoria/
site.ru/categoria/podcategoria/
RewriteRule ^([^.]+)/$ index.php?category=$1 [L]
RewriteRule ^([^.]+)/([^.]+)/$ index.php?category=$1&subcategory=$2 [L]
RewriteRule ^(.*)/(.*)/$ index.php?category=$1&subcategory=$2 [L,QSA]
RewriteRule ^(.*)/$ index.php?category=$1 [L]
Answer the question
In order to leave comments, you need to log in
RewriteCond %{REQUEST_URI} ^categoria/(.*)$
# если строка начинается с categoria
RewriteCond %{REQUEST_URI} !^categoria/podcategoria/(.*)$
# защита от цикла ! - отрицание
RewriteRule ^(categoria/)(.*)$ /$1/podcategoria/$2 [R=301,L]
# добавит у всего что есть категория подкатегорию
# 301 --- http://shop.wildorchid.ru/Catalog/StyleCard.aspx?&sale=1&shop=7&categoryid=2046&style=26778 => http://shop.wildorchid.ru/catalog/nizhnee_bele/1010-defile/
RewriteCond %{QUERY_STRING} (^|&)sale=1($|&)
RewriteCond %{QUERY_STRING} (^|&)shop=7($|&)
RewriteCond %{QUERY_STRING} (^|&)categoryid=2046($|&)
RewriteCond %{QUERY_STRING} (^|&)style=26778($|&)
RewriteRule ^Catalog/StyleCard\.aspx$ /catalog/nizhnee_bele/1010-defile/? [L,R=301]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question