Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
537 views
in Technique[技术] by (71.8m points)

mod rewrite - 500 Internal Server Error when using .htaccess with RewriteEngine

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

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

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 'xefxbbxbfRewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

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.

Thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

xefxbbxbf 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. xefxbbxbfRewriteEngine

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...