Always WWW modrewrite php
I want to force www in my urls. I'm having problems with writing. I know that this code will do the trick.
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule ^(.*)$ http://www.example.com/$1
开发者_运维技巧
But I want to put all in $_GET['page']
RewriteRule ^(.*)$ /index.php?page=$1 [L]
How should I put this together?
You need to add [QSA]
, which allows you to modify the query string of the URL:
RewriteRule ^(.*)$ /index.php?page=$1 [QSA,L]
this should do the job
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule ^(.*)$ http://www.example.com/$1
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule .* index.php?page=$0 [L]
精彩评论