.htaccess question

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

Hello
Is it possible to have a .htaccess file add PHP extensions?
IE: the server is set up to parse .php3 and .php4 as PHP, and I want it to also parse .php as a PHP file.
Is this possible?
Thanks

Laughing out loud

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

yes... same syntax

I don't have it right now, but I can find it if you need it.

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

Thank you Smiling
I haven't used htaccess in a while... what is the complete syntax for an htaccess file?
Also, does it matter if it is php3, php4, or just php? I know in my HTTPD.conf file there are different handlers which are commented out for different PHP versions

Laughing out loud

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

If you have access to httpd.conf then you have no need to use htaccess. Htaccess actually slows the site down a bit since that file constantly has to be read. The only reason to have the different php extensions is the tell the server how to parse a file. If you never use a file called .php3 or .php4, then you don't need to add this application to your site. Save all your php files as just plain .php and don't worry about it.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

This isn't for MY server...

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

You can add lines in .htaccess like so:
AddType application/x-httpd-php3 .php3
AddType application/x-httpd-php4 .php4

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

I'm getting the server encountered a configuration error... What's wrong?
AddType application/x-httpd-php3 .phtml

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

Anyone have a solution?
It just gives an Internal Server Error on every page in that directory...

[edit]
Does there need to be anything above the AddType itself?
[/edit]

Laughing out loud

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

from my config:
AddType application/x-httpd-php .php .php3 .phtml
AddType application/x-httpd-php-source .phps

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

You could be getting the error because php is not configured for version 3. I.e., you are trying to run php3 files and cannot.

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

I'm running PHP 4

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

Wink
I figured it out
I didn't upload correctly...
Thanks for your help

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.