我在我的mod_rewrite服务器下编写了以下Apache2规则并放入一个.htaccess文件中:
Options +FollowSymLinks
Options -Multiviews
RewriteEngine On
RewriteBase /db/
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]我的重写模块已启用:
root /var/www/db # a2enmod rewrite
Module rewrite already enabled
root /var/www/db # ls -al /etc/apache2/mods-enabled/rewrite.load
lrwxrwxrwx 1 root root 30 Mar 2 13:42 /etc/apache2/mods-enabled/rewrite.load -> ../mods-available/rewrite.load.htaccess文件在apache2.conf中启用
AccessFileName .htaccess当我试图访问重写的URL时,它似乎不起作用:
Not Found
The requested URL /db/user/dashboard was not found on this server.在我的apache2错误日志中:
File does not exist: /var/www/db/user
有什么想法吗?
发布于 2016-03-02 14:22:55
找到解决方案时,我忘记了站点的conf中的AllowOverride参数,它被设置为none,应该是all
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>https://stackoverflow.com/questions/35749257
复制相似问题