I’m trying to rewrite a query string in Apache.
The current (example) domain is:
example.com/?domain=domain.com
I would like this to then be rewritten into:
example.com/domain.com
So, when a user enters:
example.com/?domain=domain.com
They are always redirected to the pretty version:
example.com/domain.com
I’ve tried quite a few different rewrites, such as:
RewriteEngine On
RewriteRule ^([^/]*)$ /?domain=$1 [L]
But this fails to work (i.e. nothing happens) with .htaccess and ModRewrite enabled.
Any help would be greatly appreciated.
Try this –
Empty question mark at the end is important as it will discard the original query string.