Web服务器不读.htaccess文件 [英] Web server not reading .htaccess file

查看:156
本文介绍了Web服务器不读.htaccess文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Ubuntu 12.10安装Apache2的,和我的.htaccess文件不能正常工作。我把它设置到能够没有在链接PHP文件扩展名,所以看起来www.website.com/login~~V代替/login.php,但它说该URL/登录未找到在服务器上。我已阅读此页面并说一些有关设置AllowOverride全部但我不'知道在哪里了,或者如果我需要添加它,在这里我想补充的。

I have Ubuntu 12.10 with apache2 installed, and my .htaccess file is not working. I have it set up to be able to not have .php file extensions in the links, so it looks like www.website.com/login instead of /login.php, but it says that the URL "/login" is not found on the server. I have read this page and it says something about "AllowOverride All" but I don't know where that is, or if I need to add it, where I would add it.

编辑:我发现此链接,并已发现了什么它说,但它说我有什么网页我去上一个内部服务器错误。我已经改变了,以

I have found this link and have found what it says, but it says that I have an Internal Server Error on any page I go to. I have changed the to

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

但它说内部服务器错误

but it says Internal Server Error

编辑#2:在错误日志中,它说

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

编辑#3:在这里找到了答案:<一href="http://stackoverflow.com/questions/10144634/htaccess-invalid-command-rewriteengine-perhaps-misspelled-or-defined-by-a-m">.htaccess:无效命令'RewriteEngine叙述',也许拼错或定义由不包括在服务器结构的模块的

EDIT #3: Found the answer here: .htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

推荐答案

  • 确保您已启用了mod_rewrite在你的.htaccess。

另外,还要确保你这些线路在你的.htaccess的顶部:

Also make sure you these lines at the top of your .htaccess:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

即。转动多视​​图选项关闭。

另请参见 <一个href="http://stackoverflow.com/questions/16755169/mod-rewrite-is-enabled-but-not-working/16755191#16755191">this Q&安培; A 作为一个类似的问题,我的答案

Also see this Q&A for a similar problem and my answer.

这篇关于Web服务器不读.htaccess文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆