2016-03-02 101 views
0

我寫在我的Apache2服務器下面的mod_rewrite規則並投入.htaccess文件:的Apache2 mod_rewrite的

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

任何想法?

回答

0

發現的sollution,我忘了在現場的conf約AllowOverride參數,它被設置爲none,應該是all

<Directory /var/www/> 
     Options Indexes FollowSymLinks MultiViews 
     AllowOverride all 
     Order allow,deny 
     allow from all 
</Directory>