Rewrite Rules in shell script

Hi,

Looking for a shell script to redirect the below URLS...

1) http://domain.site.com/exmp/http://www.example.com/ofxm/supp/un_headfoot?un_head=yes redirects to http://domain.site.com/header.html

2) http://domain.site.com/exmp/http://www.example.com/ofxm/supp/un_headfoot?un_foot=yes redirects to http://domain.site.com/footer.html

Please guide me

Thanks
Wintech

When you say redirect, do you mean a cgi-script written in sh, why not use Apache's mod_redirect, it is safer and faster and specifically designed for this task?

Such a script would examine the value of $REQUEST_URI and $QUERY_STRING and if they met the criteria sent a 302 response eg

HTTP/1.1 302 Found 
Location: http://domain.site.com/footer.html

if and egrep should be enough to check the request for either pattern.

Thank Skrynesaver,

If i wanted to use mod_rewrite, Is my below RewriteRule is right? kindly guide me
1) http://domain.site.com/exmp/http://www.example.com/ofxm/supp/un_headfoot?un_head=yes redirects to http://domain.site.com/header.html
^domain.site.com/exmp/http://www.example.com/ofxm/supp/un_headfoot?un_head=yes$ http://domain.site.com/header.html [L]

2) http://domain.site.com/exmp/http://www.example.com/ofxm/supp/un_headfoot?un_foot=yes redirects to http://domain.site.com/footer.html
^domain.site.com/exmp/http://www.example.com/ofxm/supp/un_headfoot?un_foot=yes$ http://domain.site.com/footer.html [L] 

Hi,

Below is my requirement,

Rewrite Rules is not working - below is my rewrite rules

Please guide me if im wrong

Regards
Paulwintech

The documentation of the module probably offers a more complete response.

But basically the rewrite rule for the URL is a regular expression representing the request string followed the absolute URL of the redirect destination.

However this is done in the conf file appropriate to your httpd version so you really should consult the docs (and not write server configs on the say so of even relatively informed strangers on the net :wink: )