question for htaccess gurus

Locked
4days
Posts: 5465
Joined: Tue Apr 16, 2002 7:00 am

question for htaccess gurus

Post by 4days »

using some cheap hosting for a friends site, and in typical "get what you pay for" fashion, the server is playing silly buggers with what i guess is an apache configuration error. php files are being offered up for download because apache doesn't know what to do with them.

able to upload a .htaccess for the domain, but putting in a proper addhandler line for php just exposes other problems with missing information in the apache php setup. i only ever use htaccess for quite basic stuff (passwords, redirection, url rewriting etc) so am a bit stuck for ideas beyond that.

is there some conditional command i can use in a htaccess that could check if a handler exists and then take some action if it doesn't? like redirecting to another page?

moving to another host isn't an option right now. he's signed into one of those stupid deals where the hosting company owns his domain, so it's going to take at least a few days to organise the move (not doing anything until i can reach a decent contact at the current host).
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Post by ^misantropia^ »

What version of PHP, what's the underlying OS and most importantly, what version of Apache? Have you verified that mod_php has been installed properly? What errors does an AddHandler clause cause?
4days
Posts: 5465
Joined: Tue Apr 16, 2002 7:00 am

Post by 4days »

it's cheap hosting and they're not forthcoming with answers. it's a linux box, i don't have shell access to work out what the problem might be and php is the only scripting language the host offers. everything appears to be working again now, but it's been up and down all day, hence my question.

i put an addhandler in for php on the offchance that it'd show me something useful, hit refresh on the page i was on (a forum) and saw a php error about sessions not being supported, hit refresh again and then downloaded the php file. to make sure i hadn't messed up the addhandler, i added another line telling it to pass .test as html and it did. over an hour or so, the site vanished entirely a few times. they must've been restarting the box or something.

not overly concerned with the nature of the problem in their php setup (leaving straight html pages on there till i can get the guy moved), i just wondered if there was a way to get around it with htaccess if it happens again - it would be a useful snippet to have if such a thing were possible.
Locked