使用的.htaccess与RewriteEngine叙述时500内部服务器错误 [英] 500 Internal Server Error when using .htaccess with RewriteEngine

查看:533
本文介绍了使用的.htaccess与RewriteEngine叙述时500内部服务器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的共享主机 Bounceweb ,我想添加一些重写规则,使我的链接看起来prettier。

I am on the shared host Bounceweb and I am trying to add some rewrite rules to make my links look prettier.

这些规则之一是使网址: http://mysite.com/upload 指向:的http:// mysite的。 COM / upload.php的。我有这个在我的.htaccess文件:

One of these rules is to make the url: http://mysite.com/upload point to: http://mysite.com/upload.php. I have this in my .htaccess file:

RewriteEngine on
RewriteRule ^upload$ upload.php

但所有它给了我一个500内部服务器错误。我看了看我的日志,这出现了很多:

but all it's giving me is a 500 Internal Server Error. I looked at my logs and this comes up a lot:

[alert] [client 81.179.29.185] /home/minecraf/public_html/.htaccess: Invalid command '\xef\xbb\xbfRewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

这是否意味着我的主机不支持的.htaccess? pretty的跛脚,如果他们不这样做。我已经尝试过改变的.htaccess的权限为777,它并没有帮助。

Does this mean my host doesn't support .htaccess? Pretty lame if they don't. I've already tried changing the permissions of .htaccess to 777 and it doesn't help.

谢谢!

推荐答案

\ XEF \ XBB \ XBF 三种无形的垃圾字符(Apache的角度看,至少)称为统一code BOM或字节顺序标记。阿帕奇认为这些字符是正确的之后后面的命令的一部分。这是你的日志中看到,尽管这些字符转义所以他们看到肉眼。 \ XEF \ XBB \ xbfRewriteEngine

\xef\xbb\xbf are three invisible junk characters (at least from Apache's perspective) called the Unicode BOM, or byte order mark. Apache thinks that those characters are part of the command that follows right after. This is what you see in the log, though the characters are escaped so they're visible to the naked eye. \xef\xbb\xbfRewriteEngine

在编辑器中,特别是如果你的编辑器是记事本,请确保您保存您的文件没有BOM。这应该是选择在另存为对话框或其他地方。

In your editor, especially if your editor is Notepad, make sure you're saving your file without a BOM. This should be selectable in the save as dialog or elsewhere.

这篇关于使用的.htaccess与RewriteEngine叙述时500内部服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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