httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Didier Peereboom Voller <>
Subject Re: [users@httpd] Can PHP files load without extension?
Date Sun, 21 Mar 2004 23:55:49 GMT
On Sun, 2004-03-21 at 22:31, Rick van Vliet wrote:
> (bottom posting)
> > Date: Sun, 21 Mar 2004 12:27:23 -0600
> > To:
> > From: Rick van Vliet <>
> > Subject: Can PHP files load without extension?
> > Message-ID: <>
> >
> > Apache 2.048 PHP  4.3.4
> >
> > Is there a setting in apache 2.048 httpd.conf file that will allow a php 
> > page to load, without needing to supply the extension?
> > I have my DirectoryIndex set to take care of "index.php" automatically, 
> > but I would like to be able to have a php file load, as though it were 
> > an htm or html.
> >
> > I though I was able to do this with Apache 1.3x, and php 4.32, but I 
> > cannot seem to find anything googling or at, where this is 
> > very clear.
> >
> > Thanks,
> > rick
> >
> > ------------------------------
> >> Date: Sun, 21 Mar 2004 22:01:16 +0100
> >> To:
> >> From: Didier Peereboom Voller <>
> >> Subject: Re: [users@httpd] Can PHP files load without extension?
> >> Message-Id: <1079902876.30998.11.camel@localhost>
> >>
> >> yes this is possible
> >>
> >> AddType application/x-httpd-php Is the line where you tell apache that 
> >> it should handle for instance
> >> *.php as a php file. *.php3 *.phtml *.php4 are typical but it is really
> >> up to you.
> >>
> >> You can simply add any extension you want. Possibly even * if you are
> >> adventurous.
> >>
> Thanks, but it isn't really working the way I expect.
> If I set up my pages to be some HTM, and some PHP, and I want to send a 
> link to someone so
> that I don't have to remember whether it's a php or html extension...and 
> this file is not an index.* page...
> Would I add *.htm *.html to the
> "AddType application/x-httpd-php .php " line?
> Or is this some kind of a ForceType arrangement?
> (as I make these changes in the .conf file, I am restarting the server, in 
> case you're wondering :)
> thanks,
> rick

        AddType application/x-httpd-php .php
        AddType application/x-httpd-php .phtml
        AddType application/x-httpd-php .php3
        AddType application/x-httpd-php .php4
        AddType application/x-httpd-php .jpeg
        AddType application/x-httpd-php-source .phps

is what I got. 

This simply loads every *.jpeg file into the php parser. I got to make sure not to have real
images with the jpeg extension but you can ignore this.

Simply add a line with .html and every single time a html file is requested it will be put
through the parser. So if you got a lot of static content you will notice a hit on your server
but nothing more. PHP parser after all looks for <?php tag. Be aware that the <? tag
may be associated with other languages.

        AddType application/x-httpd-php .html

Should be the one you need. Simply add it to the place where the other
AddType statements are and restart. Then create two html files one with
php code and one without and watch the results.

Oh and this functionality is part of mod_mime but this should be
standard on apache.

I don't entirely get what you mean. If you don't want to remember what
extension a page is then this would not really solve that. This would
only allow you to name all your pages .html and have them all parsed.
You could possibly set up duplicates so that both myscript.php and
myscript.html are the same page (use links on a unix or copies on
windows) and make sure both extensions are parsed with the above
configuration changes.

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message