我想在我的网址中强制使用www。我写作有问题。我知道这段代码可以解决问题。
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule ^(.*)$ http://www.example.com/$1
但我想全部放入$ _GET ['page']
RewriteRule ^(.*)$ /index.php?page=$1 [L]
我该怎么把它放在一起?
答案 0 :(得分:2)
您需要添加[QSA]
,以便修改网址的查询字符串:
RewriteRule ^(.*)$ /index.php?page=$1 [QSA,L]
答案 1 :(得分:1)
这应该做的工作
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule ^(.*)$ http://www.example.com/$1
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule .* index.php?page=$0 [L]