Answer the question
In order to leave comments, you need to log in
How to write regular expressions in .htaccess correctly?
Good day everyone, I need help with .htaccess For
two days I can’t understand how it works, I just haven’t tried it.
Let's get to the point, there is a link:
domain.ru/s_shoping/shop?sid=253%23modal/bundle/82522
It contains the symbol %23, I need to replace it with (#) hash.
Such links appear, for example, if you share a link in Skype on ios, maybe other programs have the same problem.
As I just did not try to write:
RewriteRule ^(/shop\?sid=[0-9]*)?%23(modal/bundle/[0-9]*)$ /shop\?sid=$1#modal/bundle/$2 [NE,R=301,L]
RewriteRule ^(.*)?%23(.*)?$ $1#$2 [NE,R=301,L]
Answer the question
In order to leave comments, you need to log in
I had to go through the documentation again and it turned out like this:
RewriteBase /s_shoping/
RewriteCond %{QUERY_STRING} ^(.*?)(%23)(.*?)$
RewriteRule ^(shop.php?)$ shop?%1#%3 [NC,L,R=301,NE]
you have a redirect with a get request, it is not part of the url.
they do it differently.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question