[CentOS] Request rewriting - regular expressions

Tom Brown

tom.brown at goodtechnology.com
Thu Nov 24 16:14:32 UTC 2005


OK not directly CentOS this one but....

I'm trying to write a rewrite rule that uses the same(tm) syntax as 
apache mod_rewrite (or at least it understands it) The following works 
by catching ANY url comfigured in the web server and rewriting it with 
the correct http status code. The issue is that i need to redirest URL1 
to 1st location and URL2 to second location and i'm trying to get my 
match syntax correct. Can anyone advise on the reg expression that would 
distinguish betweek URL1 and URL2

thanks!

match URL into $ with ^/$
if matched then
    set SCRATCH:LOC      = http://www.example.com/en/homepage.html
    set Response         = 302
    set OUT:Location     = %{SCRATCH:LOC}
    set OUT:Content-Type = text/html
    set Body             = set Body = This page has moved, please visit
<ahref="http://www.example.com">here</a> instead.
endif




More information about the CentOS mailing list