≡ Menu

500 Internal Server Error caused by editing .htaccess file

500 internal server error caused by editing htaccess file500 internal server error caused by editing htaccess file Just wanted to write a quick post about why you might get a "500 Internal Server Error" message after editing your .htaccess file. This happened to me a few days ago, but i just ignored this message and used some work-around (can’t remember what exactly i did during that time). But i wanted to find the real issue behind this error as it was getting annoying having to encounter it more often.. I was able to pin-point the cause of the problem in matter of a few seconds. But the weird thing is that i first

tried doing a quick search for “500 Internal Server Error caused by editing .htaccess file” on Google; which was a very specific search, but i couldn’t find anything specifically related to my issue. I am sure i would have eventually ended up with a good result, but time was a factor here :) So that is the reason behind this post, I’m writing this for future reference and in case anyone else who might stumble upon this issue. OK, I know; Enough talk. The issue was the character encoding of the file. I was using the Komodo IDE instead of of my usual Notepad+, I noticed my Komodo was setup to save all files in the UTF-8 character encoding; so i decided to change the file encoding to Western European CP1252, then saved the file again and BOOM! It worked :) Please let me know if this helped you :)


{ 4 comments… add one }

  • Starhorsepax January 23, 2013, 8:38 pm

    Thank you! I had this problem! It didn’t work directly but led me to research whether the host had preferences. Turned out they automatically converted it. I had to add this: AddDefaultCharset Off to the htaccess to get it to work.

    • Zubair January 26, 2013, 12:12 pm

      @Starhorsepax – I’m glad my post contributed in helping you fix your issue, character encoding can be a tricky issue to deal sometimes. But i’m glad to hear you were able to fix your issue and also thanks for the detail regarding your issue and its solution. I’m sure it will help some one out :)

  • Masha May 10, 2013, 7:49 pm

    Great post, very helpful! I was trying to figure it out for days.

  • Jeff Wright March 8, 2014, 4:27 am

    You have three problems.

    Your first problem is using a text editor without understanding Unicode BOMs. No sane text editor writes UTF-8 with a BOM. And any decent developer understands Unicode.

    Your second problem is that you don’t keep a hex editor handy for analyzing text files.

    Your third problem is that you use .htaccess files.

Leave a Comment