S
S
strify_252017-10-05 17:23:57
ASP.NET
strify_25, 2017-10-05 17:23:57

Why don't redirects work?

There was a site running on ASP. The link structure was as follows:
site.ru/catalog.asp - general page of the catalog
site.ru/catalog.asp?id_main=86&id_sub=1 - section page (there were no pages like site.ru/catalog.asp?id_main=86)
site .ru/prod_view.asp?id=1550 - product page.
Transferred to Bitrix. Now the links are:
site.ru/katalog/ - general page of the catalog
site.ru/katalog/category/subcategory/ - section page
site.ru/katalog/category/subcategory/product/ - product page It is
necessary to make redirects from old addresses to new ones . For the general page I do:
Redirect 301 /catalog.asp http://site.ru/katalog/
OK, everything works. Next for sections:

RewriteCond %{QUERY_STRING} id_main=68&id_sub=3
RewriteRule ^catalog.asp http://site.ru/katalog/category/subcategory/? [R=301,L]

Does not work! Redirects to site.ru/katalog/?id_main=68&id_sub=3
Tried another version of the view
RewriteCond %{QUERY_STRING} ^id_main=68&id_sub=3$ [NC]
RewriteRule ^catalog.asp$ http://site.ru/katalog/category/subcategory/? [R=301,L]

The same.
Further I write for goods:
RewriteCond %{QUERY_STRING} id=1550
RewriteRule ^prod_view.asp http://site.ru/katalog/category/subcategory/product/? [R=301,L]

Doesn't work either - address stays the same, error 404
Does anyone know how to deal with this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
strify_25, 2017-10-06
@strify_25

They did it like this:

RewriteCond %{HTTP_HOST}	^site\.ru$
RewriteCond %{QUERY_STRING}	^id_main\=68&id_sub\=3$
RewriteRule ^catalog\.asp$	/katalog/sredstva-elektrozashchity/zazemleniya-perenosnye-dlya-vl/? [R=301,L]

It seems to work

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question