5
我想制作一个网站的静态副本,保留现有的网址。问题是,该网址看起来像:apache,允许使用'?'的文件名
http://mysite/index.php?id=XXX
和Apache不希望找到文件 “的index.php的id = XXX?”。相反,它将查询解释为文件“index.php”,查询“id = XXX”。
我该如何让Apache停止处理问号?
最后,我的解决方案:
1)将文件从 “?的index.php ID = XXX” 重命名为 “index.php_id = XXX”
2)添加为.htaccess:
RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} =""
RewriteCond %{QUERY_STRING} !=""
RewriteRule ^(.*)$ $1_%{QUERY_STRING} [L]