I’m trying to map any request like /?page=pagename to this /html/pagename.html ( sort of opposite of what people normally do), so for example if the request was mydomain.com/?page=home then I want my server to return this file : /html/home.html
I tried this rule, but gives my error 500 :
RewriteRule ?page=(.*) /html/$1.html [NC]
any idea folks ?
Try this:
RewriteRulematches and rewrites only URIs. The query string (the stuff after the question mark) is not part of the URI, so it’ll never match against aRewriteRulepattern. You have to use aRewriteCondto conditionally evaluate a rule (in this case, on every URI) when the query string matches something.