Используя Apache RewriteEngine, как переписать /foo
в index.php?x=foo
, но переписать /foo/bar
в index.php?x=foo&bar=true
в один RewriteRule
?
У меня есть это сейчас:
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
Это только переписывает /foo
в index.php?x=foo
, но не /foo/bar
в index.php?x=foo&bar=true
.Как я могу добавить это к RewriteRule
?