我用.htaccess
输入了以下代码
RewriteEngine on
RewriteBase /amit/
RewriteCond ${REQUEST_FILENAME} !-f
RewriteCond ${REQUEST_FILENAME} !-d
RewriteRule (.+) public/$1.php [NC,L]
本质上,它应该做的是将来自/amit/
的任何请求重定向到public/$REQUEST.php
。它一直在我的apache日志文件中返回太多的重定向错误,而我似乎就是找不到问题所在。
我是apache的新手,所以请客气一点。如果你能给我一个解释和解决方案,我会很高兴。
编辑2:有关更多信息:在localhost
根目录中,我有一个将所有请求重定向到/amit/
的.htaccess
RewriteEngine on
RewriteBase /
RewriteRule (.*) amit/$1 [NC,L]
在目录/amit/
中,我有另一个.htaccess
来相应地将请求重定向到管理员/公共:
RewriteEngine on
RewriteBase /amit/
RewriteRule ^(admin/|admin)$ admin/index.php [NC,L]
RewriteRule ^(admin_login/|admin_login)$ public/admin_login/index.php [NC,L]
RewriteCond ${REQUEST_FILENAME} !-f
RewriteCond ${REQUEST_FILENAME} !-d
RewriteRule (.*) public/$1 [NC,L]
最后,在/amit/public/
目录中,我有另一个处理该目录中的请求的方法:
RewriteEngine on
RewriteBase /amit/public/
RewriteCond ${REQUEST_FILENAME} !-f
RewriteCond ${REQUEST_FILENAME} !-d
RewriteRule (.*) $1.php [NC,L]
https://stackoverflow.com/questions/51268784
复制相似问题