RedirectMatch

RedirectMatch

Post by Kambi » Sat, 06 Feb 1999 04:00:00



Dear all,

I am trying to use redirect match command of Apache to
redirect all files with the .new extension to a phtml file w/ arguments;
ie

TEST.new would go to resulta.phtml?search=TEST

according to apache homepage instructions, i can use redirectmatch
as follows:

RedirectMatch \/(.*)\.new$
http://www.medplaza.com/resulta.phtml?search=$1

This should work except for the fact that apache is translating the
question
mark and url encoding it to
http://www.medplaza.com/resulta.phtml%3fsearch=variable

Any idea how i can switch the %3f to a ? mark in the redirect command?

Thnx in advance for your help.

Kambiz Hannani, MD
UCLA School of Medicine

 
 
 

RedirectMatch

Post by David L Nico » Tue, 09 Feb 1999 04:00:00


i don't know about phtml; with cgi if you replace the ? with a /
you can find the data in the PATH_INFO environment variable instead
of QUERY_STRING

which means adjusting your whole system and might not be possible.

The documentation for
mod_rewrite says

Quote:> If a substitution string starts with ``http://'' then the directory prefix
> will be not added and a external redirect or proxy throughput (if flag P
> is used!) is forced!

Which means, you could compile mod_rewrite in and
set up a rewrite engine within which you will have much finer-grained
control over the processing.

The rewrite engine gets invoked when a URL matches a RewriteRule
directive with the name of the engine given as the substitution token.

Since RewriteMap invokes an external processor you can be as creative
as you need to be in it.


> Dear all,

> I am trying to use redirect match command of Apache to
> redirect all files with the .new extension to a phtml file w/ arguments;

...

> Any idea how i can switch the %3f to a ? mark in the redirect command?

________________________________________________________________________

            GAT d- s++: a au+* P++++ L+++ K+ V PGP+ b++ e* h+ r+

 
 
 

1. A question about RedirectMatch

I am admittedly lost in this, I have read everything in DejaNews about it,
but I cannot get it to work. I am trying to redirect everything in
www.acadia.net/usbells/$ to www.usbells.com (only). I set up this fine:
        Redirect / http://www.usbells.com/
and that works fine. But I have tried in the <VirtualHost> and also in a
<Directory> statement to send every request for
www.acadia.net/usbells/$whatever to www.usbells.com like this:
<Directory> RedirectMatch ^/$ http://www.usbells.com
and
<Virtual Host>
RedirectMatch /usbells/^/$ http://www.usbells.com
RedirectMatch /usbells/*.html http://www.usbells.com
--
My problem is that the part of the URL, say
www.acadia.net/usbells/Preview.html gets translated as
www.usbells.com//Preview.html and I just want the top level server name in
the redirected URL.
It seems a job for the mod_rewrite, but that seems even more complex to me

--
             Pancho Cole: Webmaster and Hostmaster for Acadianet

http://www.acadia.net http://home.acadia.net/ http://home.acadia.net/pancho
Work: (207) 664-3100    FAX (207) 664-3109      Tollfree: (800) 288-5072

2. ftape problems with Connor Travan 800

3. Use of RedirectMatch and Redirect together

4. Kernel Upgrade

5. Possible for apache to RedirectMatch a url contain "?"

6. xdm & clients performance

7. RedirectMatch problem - Apache 1.3.12 Bug?

8. LILO + DOS boot record = disaster

9. RedirectMatch not working to redirect to localhost???

10. RedirectMatch vs. DirectoryIndex

11. Apache RedirectMatch syntax question

12. Apache RedirectMatch

13. RedirectMatch