You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Remo Mattei <re...@italy1.com> on 2002/11/27 20:21:51 UTC

[users@httpd] Html to php

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,

 
-- 
Ciao, 
Remo Mattei  
       

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Html to php

Posted by Joshua Slive <jo...@slive.ca>.
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.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org