我正在使用位于development.local/web/目录中的htaccess代码,将我的所有路径重定向到development.local/web/index.php文件。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /web
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?url=$1 [QSA,L]
</IfModule>
现在,我有development.local/web/作为我的基本URL。因此,所有路径都必须重定向到development.local/web/index.php,现在所有网址都将正确重定向,除了development.local/web/,这给了我一个503禁止错误。
最佳答案
很可能您没有设置 DirectoryIndex
。
将其保留在您的 .htaccess 中:
DirectoryIndex index.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
关于php - .htaccess 未重定向/to/index.php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24662883/