[TAG] Apache -- Redirect if found this "Regex"

Smile Maker britto_can at yahoo.com
Fri Jun 20 10:13:03 MSD 2008


My case was your? first guess ! 

Thanks you francis and folks.

--
Britto

--- On Thu, 6/19/08, Francis Daly <francis at daoine.org> wrote:
From: Francis Daly <francis at daoine.org>
To: TAG <tag at lists.linuxgazette.net>
Subject: Re: [TAG] Apache -- Redirect if found this "Regex"
To: britto_can at yahoo.com, "The Answer Gang" <tag at lists.linuxgazette.net>
Date: Thursday, June 19, 2008, 9:43 PM

On Thu, Jun 19, 2008 at 06:59:59AM -0700, Smile Maker wrote:

Hi there,

> The path of previous jsp files may not match to the current php files
path.
> 
> So it might through? 404 , am i right 

Comparing this with your original mail:

> I? have recently upgraded all of my jsp's to php's and pointed my
rr
> to the new server.But for the?backward compatibility How do i? say to
> apache "if it finds request for any "jsp "? go to this php
page"

...it turns out that the right answer depends on what you actually want
to do. Once you've got that clear in your head, the path to the answer
will probably be more obvious.

As a first guess, if you mean "when the client requests any url ending
in .jsp, ask the client instead to request one specific url /this.php
instead", then in the manual where you read about the Redirect already
mentioned, look down a bit further for RedirectMatch. Something like

RedirectMatch \.jsp$ http://www.example.net/this.php

might do. But that probably isn't what you wanted, based on the follow-up
emails.

As a next guess, if you mean "when the client requests any url ending in
.jsp, ask the client instead to request another url which can be derived
from the original one", then you probably still want to use RedirectMatch,
but this time include the grouping parentheses.

If you have a consistent layout across the old and the new servers,
this might work for you.

A more complicated example would be if you mean "when the client requests
one of these specific urls, ask the client instead to request a different
url, where the mapping from old to new is defined over there". In that
case your best bet is probably to look for RewriteMap in the mod_rewrite
manuals.

With a complete list of old jsp urls and equivalent new php urls, you
could try the RewriteMap thing in combination with "internal
redirects",
so that instead of asking the client to make a new request of a new url,
you return the content that the new request would have returned directly.
It's easy to do that wrong, though, so an explicit redirect is probably
the way to go.

And also, although this one is probably also not directly useful in your
case, there's no reason why a PHP script needs to be accessed at a url
that ends ".php". To avoid breaking old urls, you could configure
your
new apache to process urls that end in ".jsp" by sending the
associated
file through the PHP processor.

Oh, and stealing a .sig that is relevant here:

A: It reverses the normal flow of conversation. 
Q: What's wrong with top-posting? 
A: Top-posting. 
Q: What's the biggest scourge on plain text email discussions?

Please don't.

	f
-- 
Francis Daly        francis at daoine.org

+-+--------------------------------------------------------------------+-+
You've asked a question of The Answer Gang, so you've been sent the
reply
directly as a courtesy.  The TAG list has also been copied.  Please send
all replies to tag at lists.linuxgazette.net, so that we can help our other
readers by publishing the exchange in our monthly Web magazine:
              Linux Gazette (http://linuxgazette.net/)
+-+--------------------------------------------------------------------+-+
_______________________________________________
TAG mailing list
TAG at lists.linuxgazette.net
http://lists.linuxgazette.net/mailman/listinfo/tag


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linuxgazette.net/mailman/private/tag/attachments/20080619/c049a121/attachment.htm 



More information about the TAG mailing list