Answer the question
In order to leave comments, you need to log in
Clipping question mark via htaccess?
Good day.
The code found on the web works almost perfectly, cuts off "query strings" except for those that are actually used on the site (p= and s=), and also does not cut anything if the work is done in the site's admin panel.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} !=""
RewriteCond %{QUERY_STRING} !^p=.*
RewriteCond %{QUERY_STRING} !^s=.*
RewriteCond %{REQUEST_URI} !^/wp-admin.*
RewriteRule ^(.*)$ /$1? [R=301,L]
</IfModule>
Answer the question
In order to leave comments, you need to log in
There's the first RewriteCond
Just replace with
RewriteCond %{QUERY_STRING} !=""
RewriteCond %{THE_REQUEST} \?
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{THE_REQUEST} \?
RewriteCond %{QUERY_STRING} !^p=.*
RewriteCond %{QUERY_STRING} !^s=.*
RewriteCond %{REQUEST_URI} !^/wp-admin.*
RewriteRule ^(.*)$ /$1? [R=301,L]
</IfModule>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question