我想将这个url:sample.com/panel/index.php/api/users?page=1重写为sample.com/panel/api/users?page=1 (删除index.php),下面是我的.htaccess文件:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>但那不是工作!为什么?
我在ubuntu中使用apache2 2.4版
发布于 2017-04-17 03:04:37
检查过mod_write是否启用了吗?:sudo a2enmod rewrite
您是否检查过虚拟主机是否允许使用.htaccess?需要在虚拟主机配置中使用AllowOverride all。
https://stackoverflow.com/questions/43440953
复制相似问题