的.htaccess不工作阿帕奇 [英] .htaccess not working apache

查看:240
本文介绍了的.htaccess不工作阿帕奇的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从Linux操作系统Ubuntu运行亚马逊的EC2服务的服务器和我已经安装了Apache,PHP和MySQL。我在我的文档根目录添加.htaccess文件的/ var / www / html等。我进入这个code在里面: ErrorDocument的400 /var/www/html/404.php 键,它仍然没有显示出来<$ C C $>。我不停地进入这个命令多次:须藤服务的httpd重新启动重新启动服务器,但没有显示变化......我该如何解决这个问题?难道我做错了什么?在此先感谢!

I have a server from amazon's ec2 service running on linux ubuntu and I have installed apache, php, and mysql. I have added a .htaccess file in my document root /var/www/html. I entered this code in it: ErrorDocument 400 /var/www/html/404.php and it is still not showing up. I kept entered this command multiple times: sudo service httpd restart to restart the server but no changes displayed... How can I fix this... Did I do something wrong? Thanks in advance!

推荐答案

首先,请注意重启httpd,是没有必要的.htaccess文件。 .htaccess文件是专门针对谁没有根的人 - 也就是,没有进入到httpd服务器的配置文件,并且无法重新启动服务器。当你能够重新启动服务器,你不需要.htaccess文件,并可以直接使用主服务器配置。

First, note that restarting httpd is not necessary for .htaccess files. .htaccess files are specifically for people who don't have root - ie, don't have access to the httpd server config file, and can't restart the server. As you're able to restart the server, you don't need .htaccess files and can use the main server config directly.

其次,如果.htaccess文件被忽略,您需要检查看到了AllowOverride设置正确。请参阅<一href="http://httpd.apache.org/docs/2.4/mod/core.html#allowoverride">http://httpd.apache.org/docs/2.4/mod/core.html#allowoverride了解详细信息。您还需要确保它被设置在正确的范围内 - 即在配置中的右挡。要确保你的不是的编辑之一块,例如。

Secondly, if .htaccess files are being ignored, you need to check to see that AllowOverride is set correctly. See http://httpd.apache.org/docs/2.4/mod/core.html#allowoverride for details. You need to also ensure that it is set in the correct scope - ie, in the right block in your configuration. Be sure you're NOT editing the one in the block, for example.

第三,如果你想确保.htaccess文件,其实是被读取,把垃圾在里面。 无效线路,如无效的行HERE,在你的.htaccess文件,将导致500服务器错误当您在包含该文件的目录指向您的浏览器。如果没有,那么你没有正确的AllowOverride配置。

Third, if you want to ensure that a .htaccess file is in fact being read, put garbage in it. An invalid line, such as "INVALID LINE HERE", in your .htaccess file, will result in a 500 Server Error when you point your browser at the directory containing that file. If it doesn't, then you don't have AllowOverride configured correctly.

这篇关于的.htaccess不工作阿帕奇的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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