Answer the question
In order to leave comments, you need to log in
htaccess to cut off including and only the symbol "?", how?
Good day, dear experts.
I am using this code:
<IfModule mod_rewrite.c>
RewriteCond %{QUERY_STRING} !^$
RewriteCond %{QUERY_STRING} !(^|&)srp=
RewriteCond %{QUERY_STRING} !(^|&)q=
RewriteRule ^(.+?)\.html$ https://%{HTTP_HOST}/$1.html? [L,R=301]
</IfModule>
<IfModule mod_rewrite.c>
RewriteRule ^(.+?)\.html(?!/amp/).+$ https://%{HTTP_HOST}/$1.html? [L,R=301]
</IfModule>
...some-link.html
, with the following exceptions, ...some-link.html?srp=123
either or ...some-link.html?q=123
or ...some-link.html/amp/
...some-link.html?
(a question mark at the end and nothing else), then this character will not be cut off. Answer the question
In order to leave comments, you need to log in
It suffices to change the condition toRewriteCond %{QUERY_STRING} !^$
RewriteCond %{THE_REQUEST} \?
<IfModule mod_rewrite.c>
RewriteCond %{THE_REQUEST} \?
RewriteCond %{QUERY_STRING} !(^|&)srp=
RewriteCond %{QUERY_STRING} !(^|&)q=
RewriteRule ^(.+?)\.html$ https://%{HTTP_HOST}/$1.html? [L,R=301]
</IfModule>
<IfModule mod_rewrite.c>
RewriteRule ^(.+?)\.html(?!/amp/).+$ https://%{HTTP_HOST}/$1.html? [L,R=301]
</IfModule>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question