You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jørn <ap...@dahl-stamnes.net> on 2011/01/13 11:07:33 UTC

[users@httpd] RedirectMatch

Hello,

I got a problem with using RedirectMatch.

The following RedirectMatch line works well:
RedirectMatch 301 /Foto/Album.*img_([0-9]*)\. 
"http://www.dahl-stamnes.net/Foto/r_img.php?img=$1"

But now I want to add another RedirectMatch:

RedirectMatch 301 ^/Foto/show.*album\=(.*)$    
"http://some.other.url/album.php?album=$1"

But it does not match. After restart I tried but still get the same page. The 
logfile says:

192.168.2.10 - - [13/Jan/2011:11:01:22 +0100] 
"GET /Foto/show.php?album=some_album HTTP/1.1" 200 15850

Any way of debugging how the server handles RedirectMatch's?
Any suggestions what could be wrong with the new statement?

Thanx.

-- 
Jørn Dahl-Stamnes
homepage: http://www.dahl-stamnes.net/dahls/

---------------------------------------------------------------------
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] RedirectMatch

Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
> On Thu, Jan 13, 2011 at 5:07 AM, Jørn <ap...@dahl-stamnes.net> wrote:

> > The following RedirectMatch line works well:
> > RedirectMatch 301 /Foto/Album.*img_([0-9]*)\.
> > "http://www.dahl-stamnes.net/Foto/r_img.php?img=$1"
> >
> > But now I want to add another RedirectMatch:
> >
> > RedirectMatch 301 ^/Foto/show.*album\=(.*)$
> > "http://some.other.url/album.php?album=$1"

On 13.01.11 07:39, Eric Covener wrote:
> I don't think you can match against the query string 

It's documented in RedirectMatch docs. If it didn't, the first line wouldn't
work even.

> -- you'll need mod_rewrite.

...please, don't use mod_rewrite for something it's not needed for, and don't
advise people to do so.


-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
I wonder how much deeper the ocean would be without sponges. 

---------------------------------------------------------------------
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] RedirectMatch

Posted by Eric Covener <co...@gmail.com>.
On Thu, Jan 13, 2011 at 5:07 AM, Jørn <ap...@dahl-stamnes.net> wrote:
> Hello,
>
> I got a problem with using RedirectMatch.
>
> The following RedirectMatch line works well:
> RedirectMatch 301 /Foto/Album.*img_([0-9]*)\.
> "http://www.dahl-stamnes.net/Foto/r_img.php?img=$1"
>
> But now I want to add another RedirectMatch:
>
> RedirectMatch 301 ^/Foto/show.*album\=(.*)$
> "http://some.other.url/album.php?album=$1"
>
> But it does not match. After restart I tried but still get the same page. The
> logfile says:
>
> 192.168.2.10 - - [13/Jan/2011:11:01:22 +0100]
> "GET /Foto/show.php?album=some_album HTTP/1.1" 200 15850
>
> Any way of debugging how the server handles RedirectMatch's?
> Any suggestions what could be wrong with the new statement?

I don't think you can match against the query string -- you'll need mod_rewrite.

---------------------------------------------------------------------
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] RedirectMatch

Posted by Jørn <ap...@dahl-stamnes.net>.
On Monday 17 January 2011 11:35, Matus UHLAR - fantomas wrote:
> On 17.01.11 11:31, Jørn wrote:
> > Yes, but the probem is that RedirectMatch only check the string to the
> > left of the ?-sign.
> > I must fix this by chaning the scripts.
>
> aha!
> So, in this case, you will have to use mod_rewrite...

Or just rewrite the original scripts so that they do a redirect. I don't want 
to use mod_rewrite in this case :)

-- 
Jørn Dahl-Stamnes
homepage: http://www.dahl-stamnes.net/dahls/

---------------------------------------------------------------------
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] RedirectMatch

Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
> On Monday 17 January 2011 11:27, Matus UHLAR - fantomas wrote:
> > On 13.01.11 11:07, Jørn wrote:
> > > I got a problem with using RedirectMatch.
> > >
> > > The following RedirectMatch line works well:
> > > RedirectMatch 301 /Foto/Album.*img_([0-9]*)\.
> > > "http://www.dahl-stamnes.net/Foto/r_img.php?img=$1"
> > >
> > > But now I want to add another RedirectMatch:
> > >
> > > RedirectMatch 301 ^/Foto/show.*album\=(.*)$
> > > "http://some.other.url/album.php?album=$1"
> >
> > Tried to remove the backslash and quotes?

On 17.01.11 11:31, Jørn wrote:
> Yes, but the probem is that RedirectMatch only check the string to the left of 
> the ?-sign.
> I must fix this by chaning the scripts.

aha!
So, in this case, you will have to use mod_rewrite...

My apologies to Eric Coverner...
-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Honk if you love peace and quiet. 

---------------------------------------------------------------------
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] RedirectMatch

Posted by Jørn <ap...@dahl-stamnes.net>.
On Monday 17 January 2011 11:27, Matus UHLAR - fantomas wrote:
> On 13.01.11 11:07, Jørn wrote:
> > I got a problem with using RedirectMatch.
> >
> > The following RedirectMatch line works well:
> > RedirectMatch 301 /Foto/Album.*img_([0-9]*)\.
> > "http://www.dahl-stamnes.net/Foto/r_img.php?img=$1"
> >
> > But now I want to add another RedirectMatch:
> >
> > RedirectMatch 301 ^/Foto/show.*album\=(.*)$
> > "http://some.other.url/album.php?album=$1"
>
> Tried to remove the backslash and quotes?

Yes, but the probem is that RedirectMatch only check the string to the left of 
the ?-sign.
I must fix this by chaning the scripts.

-- 
Jørn Dahl-Stamnes
homepage: http://www.dahl-stamnes.net/dahls/

---------------------------------------------------------------------
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] RedirectMatch

Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
On 13.01.11 11:07, Jørn wrote:
> I got a problem with using RedirectMatch.
> 
> The following RedirectMatch line works well:
> RedirectMatch 301 /Foto/Album.*img_([0-9]*)\. 
> "http://www.dahl-stamnes.net/Foto/r_img.php?img=$1"
> 
> But now I want to add another RedirectMatch:
> 
> RedirectMatch 301 ^/Foto/show.*album\=(.*)$    
> "http://some.other.url/album.php?album=$1"

Tried to remove the backslash and quotes?

> But it does not match.

-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
You have the right to remain silent. Anything you say will be misquoted,
then used against you. 

---------------------------------------------------------------------
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