Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created a test directory called "rewrite" and put a .htaccess file inside with a rewrite rule.

When I go to that URL through my browser I get a 500 Internal Server Error.

So I thought it was my rewrite syntax and tried a few changes, same thing. Then I commented out everything with # on each line. Same thing.

Then I noticed that the directory doesn't show up in its parent directory (which has no index file).

So then I tried changing the filename to .htaccess_bad, and the directory shows up.

Then I changed it back to .htaccess and emptied the file, so it a blank file. The directory still shows up.

Finally I added a single # to the .htaccess file, and viola, the directory disappears again.

I though the issue might be that the parent directory has a .htaccess file with a [R] flag on its rewrite rule, but removing that didn't fix the issue.

Any help on what to try next or why this is happening?

Quick update:

Even having a line break is causing issues. (so it has to be truly empty it seems).

share|improve this question
up vote 6 down vote accepted

I'm guessing that your .htaccess file is in DOS format and it needs to be in Unix format.

share|improve this answer
this save my time..........thanks. – Imran Khan Sep 26 '14 at 11:22

Notepad++ is cool. Try this:

Edit --> EOL conversion --> Convert to UNIX format

share|improve this answer

Well, I've never had this issue before, but...

When I opened up Putty and edited the .htaccess file server-side, it worked.

That's one point off for Notepad++.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.