Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

3 Answers

up vote 4 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
add comment

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
add comment

Notepad++ is cool. Try this:

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

share|improve this answer
add comment

Your Answer

 
discard

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.