httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <jsl...@gmail.com>
Subject Re: [users@httpd] Redirect using RewriteMap and notice via SSI?
Date Sat, 07 Aug 2004 15:32:16 GMT
On Sat, 7 Aug 2004 01:26:07 -0500, Jerry A. Copus <copus@uwplatt.edu> wrote:
> Based on entries that I want to rewrite in a RewriteMap text file:
> Rewrite www.mydomain.edu/~biology to www.mydomain.edu/biology
> Rewrite www.mydomain.edu/~mathclub to www.mydomain.edu/org/mathclub
> ....and in both cases include a notice block at the top of the
> corresponding target index.html file that "You're using an old URL
> (oldurl). The new URL is (newurl)." Also, throwing the proper redirect
> response code (302 or 301) in the process....

Your idea of using an env variable will not work because env variables
are request specific and won't be passed through a redirect.  But you
could use a query string instead.  Something like this (completely
untested)

RewriteEngine On
RewriteMap legace txt:/path/to/legacy.txt
RewriteCond %{REQUEST_URI} ^/~([^/]+)(.*)
RewriteCond %{legacy:%1|NOT-FOUND} !=NOT-FOUND
RewriteRule ^/~.* /%{legacy:%1}%2?legacy [R=permanent]

Then you test the QUERY_STRING for "legacy" in the target document to
see if you need to display the warning at the top.

Joshua.

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


Mime
View raw message