昨天我在我的Ubuntu 10.04上安装了LAMP。 起初一切似乎都很好,但是,当我启动我的PHP应用程序(我从Windows 7中复制它,我使用XAMPP),它不接受我的.htaccess文件。 所以我所有的URL都被打破了。
我为.htaccess工作。
1.在./sites-available/中创build单独的configuration文件时,我将“目录”部分的AllowOverride从“ None更改为“ All
<Directory /some_path/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory>
2.我的.htaccess文件的第一行是RewriteEngine On 。
在XAMPP的Windows上一切正常。 当我启动http:// localhost它给了我500内部服务器错误。 当我将AllowOverride更改回None ,它将在我的根文件夹中打开index.html,而不是index.php。
UPD:error.log说关于错误500:
[Sat Jun 26 09:40:53 2010] [alert] [client 127.0.0.1] /some_path/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
任何人都可以提出任何解决scheme,如何解决它?
根据错误信息mod_rewrite还没有被加载。 用a2enmod rewrite激活它, a2enmod rewrite用service apache2 restart启动你的Apache httpd。
你似乎没有安装或激活mod_rewrite在你的Apache安装。 该线
Invalid command 'RewriteEngine'
很清楚 当您将AllowOverride设置为none , .htaccess文件根本不会被parsing,因此不会显示错误消息。
你将不得不激活或安装mod_rewrite模块。