You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Julian C. Dunn" <Ju...@cbc.ca> on 2006/09/21 16:50:00 UTC

[users@httpd] managing mass Apache Redirects

Does anyone have any solutions for managing a huge number of Apache
redirects in a manner external to Apache? What I am looking to do is to
store Redirect source and targets in some kind of DB. It's kind of like
RewriteMap but I don't actually want to use the key and values in future
directives.

Ideally it would be possible to instruct Apache (either implicitly or
explicitly) to refresh its Redirect map without restarting Apache
itself.

Any suggestions?

- Julian

-- 
-- Julian C. Dunn, P.Eng.  <Ju...@cbc.ca>
-- Platform Administrator * CBC.ca Production & Operations
-- Office: 2C310-J  *  Tel.: (416) 205-3311 x6988


---------------------------------------------------------------------
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] managing mass Apache Redirects

Posted by Joshua Slive <jo...@slive.ca>.
On 9/21/06, Julian C. Dunn <Ju...@cbc.ca> wrote:
> On Thu, 2006-09-21 at 10:59 -0400, Joshua Slive wrote:
>
> > On 9/21/06, Julian C. Dunn <Ju...@cbc.ca> wrote:
> > > Does anyone have any solutions for managing a huge number of Apache
> > > redirects in a manner external to Apache? What I am looking to do is to
> > > store Redirect source and targets in some kind of DB. It's kind of like
> > > RewriteMap but I don't actually want to use the key and values in future
> > > directives.
> > >
> > > Ideally it would be possible to instruct Apache (either implicitly or
> > > explicitly) to refresh its Redirect map without restarting Apache
> > > itself.
> >
> > Umm... This is exactly like RewriteMap.  And RewriteMap does not need
> > a restart to be refreshed.  What is it that you need that RewriteMap
> > doesn't provide?
>
> Hmm... maybe I just need some guidance with the use of RewriteMap. If a
> looked-up key is not found in the map, what happens? Will Apache consult
> the DocumentRoot to see if the directory exists, will the JKMounts be
> consulted, etc.? I am unclear as to the order of precedence.

You specify a "default" value when you do RewriteMap lookups.  You can
then key off this default value to do whatever you want.  For example:

RewriteEngine on
RewriteMap    redirect-map  dbm:/path/to/map.file
RewriteCond   ${redirectmap:%{REQUEST_URI}|NOT-FOUND} !=NOT-FOUND
RewriteRule   ^/.*  ${redirectmap:%{REQUEST_URI}} [R]

That set of rules will redirect any request for which the request_uri
can be found in the map.file, but will ignore any other requests.
(There is probably a way to do that without requiring two map lookups,
which would be more efficient.)

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


Re: [users@httpd] managing mass Apache Redirects

Posted by "Julian C. Dunn" <Ju...@cbc.ca>.
On Thu, 2006-09-21 at 10:59 -0400, Joshua Slive wrote:

> On 9/21/06, Julian C. Dunn <Ju...@cbc.ca> wrote:
> > Does anyone have any solutions for managing a huge number of Apache
> > redirects in a manner external to Apache? What I am looking to do is to
> > store Redirect source and targets in some kind of DB. It's kind of like
> > RewriteMap but I don't actually want to use the key and values in future
> > directives.
> >
> > Ideally it would be possible to instruct Apache (either implicitly or
> > explicitly) to refresh its Redirect map without restarting Apache
> > itself.
> 
> Umm... This is exactly like RewriteMap.  And RewriteMap does not need
> a restart to be refreshed.  What is it that you need that RewriteMap
> doesn't provide?

Hmm... maybe I just need some guidance with the use of RewriteMap. If a
looked-up key is not found in the map, what happens? Will Apache consult
the DocumentRoot to see if the directory exists, will the JKMounts be
consulted, etc.? I am unclear as to the order of precedence.

- Julian

-- 
-- Julian C. Dunn, P.Eng.  <Ju...@cbc.ca>
-- Platform Administrator * CBC.ca Production & Operations
-- Office: 2C310-J  *  Tel.: (416) 205-3311 x6988


---------------------------------------------------------------------
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] managing mass Apache Redirects

Posted by Joshua Slive <jo...@slive.ca>.
On 9/21/06, Julian C. Dunn <Ju...@cbc.ca> wrote:
> Does anyone have any solutions for managing a huge number of Apache
> redirects in a manner external to Apache? What I am looking to do is to
> store Redirect source and targets in some kind of DB. It's kind of like
> RewriteMap but I don't actually want to use the key and values in future
> directives.
>
> Ideally it would be possible to instruct Apache (either implicitly or
> explicitly) to refresh its Redirect map without restarting Apache
> itself.

Umm... This is exactly like RewriteMap.  And RewriteMap does not need
a restart to be refreshed.  What is it that you need that RewriteMap
doesn't provide?

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