Apache URL 重写不起作用

Apache URL 重写不起作用

目前我可以通过这种方式访问​​我的url。

xxxxxx.com/index.php/login

但我想

xxxxxx.com/login

所以我使用了以下重写序列

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L] 

但是 xxxxxx.com/login 显示 404 Not found。

rewrite.load 存在于 mods-enabled/

答案1

您使用 .htaccess 文件吗?请检查 Vhost 配置中的 AllowOverride 指令,应该是:AllowOverride All。

答案2

在 /etc/apache2/sites-available/default 中将 AllowOverride None 替换为 AllowOverride 。apache 未读取 .htaccess 文件,因为它的配置文件不允许 htaccess 覆盖先前给出的指令。

相关内容