【发布时间】:2017-10-15 03:20:42
【问题描述】:
我是第一次使用.htaccess,但遇到了循环问题。我正在努力实现以下目标:
http://something.com重写为http://something.com/mainhttp://something.com/anything重写为http://something.com/index.php?page=anything
到目前为止,我目前的尝试看起来是这样的,效果令人满意:
RewriteEngine on
RewriteBase /
RewriteRule ^/?$ /main [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?page=$1 [NC,L]
但是,我想删除这两个重写条件以允许对http://something.com/index.php 的请求变为http://something.com/index.php?page=index.php。删除两个RewriteCond 行会导致循环,并且重写不起作用。
我做错了什么,我该如何解决这个问题?谢谢!
【问题讨论】:
标签: php apache .htaccess mod-rewrite url-rewriting