3

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

8

I guess your .htaccess file is in DOS format and it needs to be in Unix format.

3

Do not save .htaccess in UTF-8 encoding and convert it to a regular ansi. In my case server don't like this BOM thing at the very begining of the file.

2

Notepad++ is cool. Try this:

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

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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