Htaccess file brings site down


#1

Hello, I’m trying to use htaccess to rewrite old URLs to new ones.

My htaccess file and rules are as follows
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteRule ^ABCDE.htm$ XX/XXXXXX/index.html [R,NC]

My error log is showing this kind of thing: [Tue Jun 22 03:13:58 2010] [error] [client XX.XX.XX.XX] File does not exist: /home/XXX/www/XXXXX.com/v1/missing.html, referer: http://XXXXX.com/ABCDE.htm

The Rewrite rule seems to be catching the target URL but I’m not getting redirected: a 500 error is being generated. In fact, a single RewriteRule for one page on the site generates a site-wide 500 error, bringing the entire site down.

After further tests I discovered that even an empty htaccess file produces the same results.

Has anyone had this problem? Does anyone have any advice? I’ve of course written Support and am awaiting a reply, but in the meantime, I’ve got a customer anxious to launch his new site.

I’m using htaccess for this purpose on another Dreamhost server and don’t understand why I’m getting such bizarre behavior on braves.

Thanks,
Toto

P.S. Wondering if Extra Web Security was producing this behavior, I deactivated EWS and am still getting the same result.


#2

are there other .htaccess files in subdirectories that might be causing the problems? they can override or add to the .htaccess file in the root directory.


#3

Hi, Bobcat,

No there are no other htaccess files on the domain. I’m really stumped, but feel pretty sure it’s gotta to be a server level problem.

Toto


#4

Your domain shouldn’t have /www/ in its path. Any idea where that’s getting set?


#5

The www directory is one I set up and is part of a standard directory system I use for my sites on Dreamhost:

  • Home/UserName/www/DomainName/SiteVersion/

You’re seeing it in the Error Log, which is correct. So this is not part of the problem, but thanks for taking a look. Got any other ideas?


#6

How are you editing these .htaccess files. Are you using a *nix editor, or one that creates true *nix style line endings? Did you make that empty file with an editor or using touch? If the empty file causes this, I’d suspect something is not right with the file itself.


#7

I know this can be a problem. But I’m using BBEdit, a pure text editor, with the option set for Unix style linefeeds and I checked the files twice… if not six times… to make sure. Besides, could an incorrect linefeed in a htaccess file bring down an entire site with a 500 error? Just wondering.


#8

Yes, actually. If Apache can’t figure out your .htaccess file, it’ll throw a 500 error. There’s a good reason for this: if you were using .htaccess for access protection (e.g, password protection or IP restrictions), ignoring the broken .htaccess and letting people through could give them access to parts of your site you didn’t want them to see, so Apache just assumes the worst and blocks all access.


#9

Yes, of course. My question was rhetorical. I’m still no closer to a solution, though.


#10

I (accidentally) changed my .htaccess file from ANSI to UTF-8 once with Notepad++ and broke the whole site because the server couldn’t read it properly. It could be an encoding issue. Try making your .htaccess file in vi or something just to check.

Also check your symlinks (or aliases or however you are using your www dir)…


#11

THAT DID IT, BOBCAT! Thanks ever so much. I was encoding in UTF-8. Switched to ISO Latin 1 and I’m now in business!![hr]

THIS was my problem. Thanks, Bobcat. My .htaccess file was being encoded in UTF-8 and I changed it to Latin 1 and everything is working wonderfully. Thank you all for your help.


#12

great!