httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <>
Subject Re: [users@httpd] Html to php
Date Wed, 27 Nov 2002 19:31:08 GMT
On Wed, 27 Nov 2002, Remo Mattei wrote:

> Hi guys I am updating a site that has links on search engines that are
> really high in ranking but they are in .html and I want to have the new one
> in .php is there a way that I can do that with some reg expr. With mod
> rewrite mod, I am not sure but any suggestions are appreciated. Of course I
> would like to have the ability to still use some .html extentions. Thanks,

Apache is very flexible with urls, so there are tons of different ways to
do this.  Perhaps the simplest is to just have php parse ALL your .html
files (AddType application/x-php-whatever .html).  The disadvantage is
that it will unnecessarily slow the delivery of plain html.

Probably the best way to do it is to use that same AddType directive, but
scope it inside <Directory> and <Files> sections to make sure that it only
applies to the files you want.

You can use the regular .php extensions for your php files and
have apache remap the url.  To do this individually for each file, you
would use something like
Alias /path/to/file.html /full/unix/path/to/file.php

There are various ways of doing a bunch of files at a time, but it all
depends on how you can tell the difference between your true html files
and your php files.

Finally, you can use either an ErrorDocument or a RewriteRule to catch all
failing requests for .html files and see if there is a similar .php file
that can be served.  This can be slow for lots of requests, however.

I'm sure there are other ways.  If you want more specific help, you'll
need to more specifically outline your needs.


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