Using Apache's RewriteEngine, how to rewrite /foo
to index.php?x=foo
but rewrite /foo/bar
to index.php?x=foo&bar=true
in one RewriteRule
?
I have this now:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)? index.php?x=$1 [L,NC] # rewrites /foo to index.php?x=foo, but not /foo/bar to index.php?x=foo&bar=true
This only rewrites /foo
to index.php?x=foo
, but not /foo/bar
to index.php?x=foo&bar=true
. How can I add that to the RewriteRule
?