![](/img/trans.png)
[英]htaccess in sub-folder in code-igniter project does not work for live server but works in localhost
[英].htaccess doesn't work on localhost, but on live server does (htaccess override is on)
这个确切的.htaccess可以在实时服务器上使用,但不能在localhost(使用Web结构显示页面)上使用,为什么?
RewriteEngine On
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\.(css|js|icon|zip|rar|png|jpg|gif|pdf)$ /public/index.php [L]
该.htaccess可以在以下两种情况下使用
RewriteEngine On
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\.(css|js|icon|zip|rar|png|jpg|gif|pdf)$ index.php [L]
我做错了,但是不知道怎么办,请帮帮我。
localhost
上是否有一个/public
文件夹? 似乎此文件夹仅存在于实时系统中。 或最终,DocumentRoot有所不同。
无论如何,我看到的唯一区别是:
/public/index.php
这是DocumentRoot
的绝对路径。 -> /path/to/DocumentRoot/public/index.php
index.php
这应该是来自DocumentRoot
的相对路径。 -> /path/to/DocumentRoot/index.php
确保您重写到正确的位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.