关于Debian Linux 6.0问题的Apache2 mod_重写
我在Apache2服务器下编写了以下mod_重写规则,并将其放入.htaccess文件中:关于Debian Linux 6.0问题的Apache2 mod_重写,apache,mod-rewrite,Apache,Mod Rewrite,我在Apache2服务器下编写了以下mod_重写规则,并将其放入.htaccess文件中: Options +FollowSymLinks Options -Multiviews RewriteEngine On RewriteBase /db/ RewriteCond $1 !^(index\.php|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRul
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错误日志中:
文件不存在:/var/www/db/user
有什么想法吗?找到了解决方案,我忘记了站点配置中的
AllowOverride
参数,它被设置为none
,应该是all
:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
选项索引跟随符号链接多视图
允许超越所有
命令允许,拒绝
通融