我想在我設置的Ubuntu服務器上啓用.htaccess文件。我改變了網站上的文件來自:問題啓用.htaccess
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
[unnecessary config code omitted]
</VirtualHost>
到
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/document_root
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/document_root>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
[unnecessary config code omitted]
</VirtualHost>
現在,當我嘗試在我的瀏覽器查看網頁,我得到一個500內部服務器錯誤。關於我的問題可能是什麼的任何想法?謝謝您的幫助。
編輯
這裏是我的.htaccess文件:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
我檢查Apache的錯誤日誌的要求,看來,被記錄的錯誤是:
[ Fri Jul 10 19:39:12 2009] [alert] [client 192.168.1.1] /var/www/document_root/.htaccess: 無效的命令「RewriteEngine敘述」,也許 拼寫錯誤或由 模塊定義不包括在服務器配置
您的.htaccess文件中可能存在語法錯誤。你可以提供你的.htaccess文件的內容,並看看ErrorLog(/var/log/apache2/error.log) – 2009-07-10 23:12:27