You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by el...@hispagate.com on 2002/06/10 17:00:47 UTC

Treat .html files as .php files in virtualhosts.

Hi to everybody!

I'm trying to enable PHP based on virtualhosts in my apache
server, also allow users on certain vhosts to use .html
files as a php files.

Here is the brief description of the server and the config :
x86 / Linux Red Hat 7.2 / Apache 1.3.22 / PHP 4.0.6 

Extracts of httpd.conf :

.....

AddType application/x-tar .tgz
AddHandler cgi-script .cgi .pl
AddType text/html .shtml .html .htm
AddHandler server-parsed .shtml .html .htm

.....

<VirtualHost *>
   Options None
   ServerName anyname.com
   ServerAlias www.anyname.com
   DocumentRoot /var/www/anyname.com/HTML
    <Directory /var/www/anyname.com/HTML>
      <IfModule mod_php4.c>
        DefaultType application/x-httpd-php
        RemoveType .html .htm
        RemoveHandler .html .htm
        AddType application/x-httpd-php .php .htm .html
      </IfModule>
    </Directory>
</VirtualHost>

No problem if I try to access the .php files, the server
supplies the correct code and the browser parses it, but
every time I try to access a .html file that is in fact a
php, the browser asks me to open or save as the file !! :-(

Any ideas on how to allow php scripts be named .html ?

I don't know if this is a PHP/Apache version
incompatibility, configuration mistake, or what the hell :-)

Thanks in advance,

-John.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org