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).

link|improve this question

25% accept rate
feedback

3 Answers

up vote 2 down vote accepted

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

link|improve this answer
feedback

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++.

link|improve this answer
feedback

Notepad++ is cool. Try this:

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

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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