I have searched all over Stackoverflow and Googled wide and far, but I cannot get this seemingly simple task done.
I'm trying to set a rule in htaccess to clean the URL by removing the query string, but leaving its value intact:
http://example.local/?p=subscribe
Becomes:
http://example.local/subscribe
I have tried these various methods:
RewriteEngine on
RewriteCond %{QUERY_STRING}
RewriteRule (.*) /$1? [R=301,L]
or,
RewriteCond %{QUERY_STRING} ^p=$ [NC]
RewriteRule ^(/?)?$ $1? [R=301,L,NC]
or,
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /\?([^\ ]+)
RewriteRule ^$ /%1? [R=301,L]
But nothing works!
Any help will be greatly appreciated.
/?p=subscribebecomes/subscribe