Answer the question
In order to leave comments, you need to log in
How to set rewrite rule only for GET parameter (query string)?
Hello. There is a site . There is a url (
http://stopgo.by/audi/a6313/a6c64f2004-2011718?attr_id=58
). The GET parameter serves as a filter here (this is the part ID). http://stopgo.by/catalogs?attr_id=70
). part-id=42
, that is, so that, for example, http://stopgo.by/catalogs/part-id=42
orhttp://stopgo.by/audi/a6313/a6c64f2004-2011718/part-id=42
. Answer the question
In order to leave comments, you need to log in
you want to change only the get parameter itself?
# 301 --- stopgo.by/audi/a6313/a6c64f2004-2011718?attr_id=58 => stopgo.by/audi/a6313/a6c64f2004-2011718?attr_id=58
RewriteCond %{QUERY_STRING} (^|&)attr_id\=([0-9]{1,})($|&)
# если есть такой гет параметр
RewriteRule ^(.+)$ /$1\?part_id=%2 [L,R=301]
#То выделить все что есть в урле и прихреначить к нему такой гет параметр
$1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question