我安装了apache2的Ubuntu 12.10,而我的.htaccess文件无效。我已将其设置为能够在链接中没有.php文件扩展名,因此它看起来像www.website.com/login而不是/login.php,但它表示找不到URL“/ login”在服务器上。我已经阅读了this page并且它说了一些关于“AllowOverride All”但我不知道它在哪里,或者我是否需要添加它,我会添加它。
编辑:我找到了this link并找到了它的内容,但它说我在任何页面上都有内部服务器错误。我已将其更改为
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
但它表示内部服务器错误
编辑#2:在错误日志中,它显示
/var/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
答案 0 :(得分:1)
还要确保这些行位于.htaccess:
的顶部Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
即。关闭MultiViews
选项。
另请参阅 this Q&A 了解类似问题和我的答案。
答案 1 :(得分:0)
您应该在apache配置中拥有或指定Directory-block。您可以在此处找到AllowOverride
文档:http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride
有关<Directory>
的文档在这里:http://httpd.apache.org/docs/2.2/mod/core.html#directory
简而言之:指定您希望使用<Directory /path/to/your/directory>
覆盖设置的位置,然后在该目录块中使用AllowOverride all
。