Need some quick help with url rewriting.
Currently using the following in an htaccess file:
DirectoryIndex /index.php?Screen=Home&Category=1
If we hit www.website.com it loads -> /index.php?Screen=Home&Category=1 and we don’t show the ugly url.
We are wanting to capture url parameters however but they are being sent to a 404. So if you navigate to www.website.com/?param=1 it doesn’t work. We are not capturing the url parameter and appending it to the directory index string.
So we want www.website.com/?param=1 to hit /index.php?Screen=Home&Category=1¶m=1
We tried to use:
RewriteRule ^/\?(.*)$ /index.php?Screen=Home&Category=1&%1 [L]
But had no luck…
Any ideas on how to do this?
You can’t match against the query string in a
RewriteRuleexpression. But using theQSAflag essentially does what you want: