.htaccess未重定向/to/index.php
我正在使用位于development.local/web/目录中的htaccess代码将我的所有路径重定向到development.local/web/index.php文件.htaccess未重定向/to/index.php,php,apache,.htaccess,mod-rewrite,redirect,Php,Apache,.htaccess,Mod Rewrite,Redirect,我正在使用位于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 RewriteRul
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /web
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?url=$1 [QSA,L]
</IfModule>
重新启动发动机
重写数据库/网络
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重写规则^(.*)$/index.php?url=$1[QSA,L]
现在,我的基本url是development.local/web/。因此,所有路径都必须重定向到development.local/web/index.php。从现在起,除了development.local/web/之外,所有URL都将正确重定向,这给了我一个503禁止的错误。很可能您没有
DirectoryIndex
设置
将其保存在.htaccess中:
DirectoryIndex index.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
很可能您没有
DirectoryIndex
设置
将其保存在.htaccess中:
DirectoryIndex index.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
为什么您有
RewriteBase/web
?是的,我的项目的所有文件都存储在development.local/web/中,但是您的URIdevelopment.local/foo/bar
中没有/web/
。/web
是您的文档根目录吗?否,/web将被视为development.local的一个子目录,并包含.htaccess文件。为什么您有RewriteBase/web
?是的,我的项目的所有文件都存储在development.local/web/中,但是在您的URIdevelopment.local/foo/bar
中没有/web//code>。/web
是您的DocumentRoot吗?否,/web将被视为development.local的子目录,并包含.htaccess文件。第一次尝试时非常棒的疑难解答靶心,+1:)第一次尝试时非常棒的疑难解答靶心,+1:)