Forum Moderators: coopster

Message Too Old, No Replies

Need help with .htaccess file

trying to make html parsed for php

         

prozak76

8:16 pm on Jan 5, 2004 (gmt 0)

10+ Year Member



I am trying to setup my htaccess file to read my html files as php. How would I do this, or where can I find how to do it?

coopster

8:29 pm on Jan 5, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, prozak76!

I think you want to take a look at the Apache AddType [httpd.apache.org] directive.

<edit>Forgot to Welcome you here!<edit>

[edited by: coopster at 8:36 pm (utc) on Jan. 5, 2004]

coopster

8:35 pm on Jan 5, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You may also want to have a look at this thread on WebmasterWorld regarding Parsing PHP with HTML file extension [webmasterworld.com]

prozak76

9:31 pm on Jan 5, 2004 (gmt 0)

10+ Year Member



Ok I am really new at this stuff.
This is a copy of my current htaccess file.

I want to add a line so that .html files are read as .php files. Is it possible?

How do I do it?

<Files .htaccess>
deny from all
</Files>

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} MSIECrawler [OR]
<snip>
RewriteCond %{REMOTE_ADDR} ^192\.168\.****\.xx$
RewriteRule .* - [F]

Sorry for the long post, but that is the only way I know how to do it.

[edited by: jatar_k at 4:14 pm (utc) on Jan. 6, 2004]
[edit reason] snipped extra code and generalized IP [/edit]

bcolflesh

9:33 pm on Jan 5, 2004 (gmt 0)

prozak76

10:00 pm on Jan 5, 2004 (gmt 0)

10+ Year Member



Ok I got that post in the forum, but I am dumb with htaccess. I added the line I found in that post to my htaccess file, but that just makes things worse. I can not view any pages with it in my htaccess

volatilegx

5:54 pm on Jan 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try this .htaccess setup:

Options +ExecCGI +Includes
AddHandler server-parsed php html
AddHandler cgi-script cgi php html

kknusa

8:15 pm on Jan 6, 2004 (gmt 0)

10+ Year Member



Try this if u have php4

AddType x-mapp-php4 .html

prozak76

9:25 pm on Jan 6, 2004 (gmt 0)

10+ Year Member



how do I know which version of php I have?

coopster

9:36 pm on Jan 6, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You can use the phpinfo [php.net] function to determine your version.

prozak76

9:44 pm on Jan 6, 2004 (gmt 0)

10+ Year Member



This is turning out to be harder than I thought. I have tried EVERYTHING. I can not get this to work.
It is a real disappointment too. I really wanted to run this script on my index page, but it WILL NOT work. I am trying to run a headline generator that only works with php on my index page, but my web server will not allow me to rename my index page as .php, .php3 .php4 nothing. It only functions as index.html.

Any other suggestions?

bcolflesh

9:47 pm on Jan 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



my web server will not allow me to rename my index page as .php, .php3 .php4

You would need to add index.php to the array of possible index files in the httpd.conf - ask your host.