Reputation: 21
I used following htacces code for removing date= query string from the URL
RewriteCond %{QUERY_STRING} (?:^|&)date=(.*)$
RewriteRule ^paivamaara/(.*)$ /paivamaara/$1?date=%1 [L,R]
its working on simple PHP file but when applied to Wordpress; its not working anymore.
Please help
Upvotes: 1
Views: 212
Reputation: 786091
That rule doesn't look right for removal of date
parameter because you are adding it back in target.
You can use this redirect rule just below RewriteEngine On
line to remove a specific query parameter:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^(.*&)?date=[^&]*(?:&(.*))?$ [NC]
RewriteRule ^ %{REQUEST_URI}?%1%2 [R=302,NE,L]
# all WP rules come below this line
Note that this rule allows your query parameter to be positioned anywhere in a query string.
Here is regex demo for the regex used above.
Upvotes: 1