如何为Ubuntu 11.04启用mod_rewrite Apache模块?


26

在像CentOS这样的其他Linux中,它可以工作,但是我不能在Ubuntu 11.04中运行它。

/var/www/html/folder/public/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

Answers:


55

您确定RewriteEngine已开启吗?

您需要验证是否已启用mod-只需在/ etc / apache2 / mods-enabled中查找rewrite.load符号链接。如果不是,请运行sudo a2enmod rewrite以启用它。使用重启apache sudo service apache2 restart并提供.htaccess语法正确,这将起作用。

否则,您将需要粘贴有关.htaccess文件的更多信息。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.