[thelist] rewrite/redirect php3 to php?

deke web at master.gen.in.us
Mon Aug 27 14:20:17 CDT 2001


On 27 Aug 2001, at 19:50, muinar posted a message which said:

> I switched to a new server which has php4 installed instead
> of the old php3. I renamed all the pages and links to .php
> (The old version needed the filename ending php3)
 
> Now when a visitor uses an old bookmark which ends with .php3,
> he will get a 404 error. Is there a way to rewrite or redirect
> users to the according php page? If this can be done with
> mod_rewrite in Apache, I'd appreciate any hints.

How about RedirectMatch?

Syntax: RedirectMatch [status] regex URL
Context: server config, virtual host, directory, .htaccess
Override: FileInfo
Status: Base
Module: mod_alias

This directive is equivalent to Redirect, but makes use of 
standard regular expressions, instead of simple prefix 
matching. The supplied regular expression is matched 
against the URL-path, and if it matches, the server will 
substitute any parenthesized matches into the given 
string and use it as a filename. For example, to redirect 
all GIF files to like-named JPEG files on another server, 
one might use:

RedirectMatch (.*)\.gif$ http://www.anotherserver.com$1.jpg


------------------------
 "The church is near but the road is icy; 
  the bar is far away but I will walk carefully." 
                            -- Russian Proverb




More information about the thelist mailing list