2
我使用.htaccess
首次,我遇到一个循环的问题到index.php。我试图实现以下目标:的.htaccess重写每一个请求
http://something.com
重写为http://something.com/main
http://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
行会导致循环,重写不起作用。
什么我做错了,我怎么能解决这个问题?谢谢!
谢谢!这完全按照我想要的方式工作。重写适用于Web应用程序,该应用程序从外部CDN动态加载内容。在这种情况下,所有行为都是通过'index.php'来实现的。 –