Add omitted ? to URLs
I am working on a website with a CMS that reads the page as the name of the query string, e.g.
http://exmaple.com/?pagename
. I am trying to create a rewrite rule to rewrite it to with the ?
.
So, a user types in /pagename
开发者_如何学编程 and is really taken to /?pagename
Try this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?(.*) index.php?$1 [L]
精彩评论