Forum Moderators: phranque

Message Too Old, No Replies

My .htaccess file messed up my site

I messed up my site, please help me restore it to its glory!

         

eliteapu

3:59 am on Jun 19, 2007 (gmt 0)

10+ Year Member



Hey everyone, and before I start to explain my problem I want to thank you for even viewing this page!

Okay, here we go...

My original problem was that my server or something, wasn't letting me use php in html...so after a quick google I found this:

RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
(http://www.example.biz/php/phpinhtml.html)

So I go to my .htaccess, and add those lines, and upload the NEW AND IMPROVED file!

Well, thats where I learned that from that point on, everytime I went to a .php file I had (for example a simple .php email script) it would either prompt for a download, or show bits of code throughout the page.

So, once again, I thought I could handle it by searching google...and after alot of different tries, after changing my .htaccess file for about 2 hours with no luck, I decided I would register here and post for some assistance.

if anyone could help me, or even give me a guess or pointer in the right direction I would be very grateful.

(If you guys don't know how to FIX it, I wouldnt mind resetting it all, but how would I do that?)

Thanks again,
Sean
aka
aPu

[edited by: jatar_k at 11:55 am (utc) on June 19, 2007]
[edit reason] no urls thanks [/edit]

jdMorgan

4:53 am on Jun 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd suggest you get rid of the RemoveHandler, and don't include PHP in the list of filetypes:

AddType application/x-httpd-php .htm .html

Others have luck with:

AddHandler application/x-httpd-php .htm .html

... it seems to depend on the server configuration and possibly, the PHP version.

more info [google.com]

Jim

eliteapu

2:01 pm on Jun 19, 2007 (gmt 0)

10+ Year Member



Well, that will help with the original problem of parsing php in html...but my site keeps prompting for downloads on php and html files now...I dont know how to reset it all! lol..

Thanks for the reply, but do you happen to have any other wisdom on the topic?

eliteapu

2:03 pm on Jun 19, 2007 (gmt 0)

10+ Year Member



sorry for the double post, but a better way to word it is I need

HTML to parse as HTML (and not prompt for download on .html / .htm files)

and

PHP to parse as PHP (and not prompt for downloads on .php files)

:) I dont know if that clarifies but...thats the only way I know to say it.

Thanks again,
~Sean

jdMorgan

2:57 pm on Jun 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your original requirement was to parse html pages for PHP code included on those pages. Has this changed?

The problem is that early PHP used a 'kludge' to get the server to execute PHP code. They used the "AddType" directive (incorrectly) instead of the AddHandler directive. We live with the resulting problems today.

As a result, all I can do is refer you to the "more info" link above, suggest that you read through the first ten threads (you'll see that you're not the only one with this problem), and try *all* of the various work-arounds.

One thing that makes a major difference (from reading those threads myself before linking to them) is whether your PHP is executed as CGI or as an Apache module. To reduce the time you spend researching and experimenting on your server, ask your host which way they have PHP configured on your server.

We also have a PHP forum here at WebmasterWorld, and there are several good threads in the PHP forum library about configuring PHP.

Jim

eliteapu

3:25 pm on Jun 19, 2007 (gmt 0)

10+ Year Member



thank you very much sir, and it was stupid of me not to read through existing articles first. Sorry.

Thanks again
~Sean