这个确切的.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]
我做错了什么,但不知道是什么,请帮助我。
答案 0 :(得分:0)
/public
上是否有localhost
个文件夹?看起来这个文件夹只存在于live-system上。或者最终DocumentRoot不同。
无论如何,我看到的唯一区别是:
/public/index.php
这是DocumentRoot
的绝对路径。 - > /path/to/DocumentRoot/public/index.php
index.php
应该是DocumentRoot
的相对路径。 - > /path/to/DocumentRoot/index.php
确保您正在重写到正确的位置。