httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Andersson" <>
Subject Re: [users@httpd] Please help me with this error document directive
Date Wed, 10 Dec 2003 06:28:48 GMT
Jon Block wrote:
> Here are some URL's that should *not* hit my ErrorDocument directive....
> ...snip...
> Here are the url's that *should* hit my error handler
> ...snip...

Perhaps it doesn't have to be an error document? If I understand your
requirements, this rewrite rule should do it:

    # VirtualHost context assumed
    RewriteEngine On
    # Only continue if it is a request that can be handled
    RewriteCond %{REQUEST_URI} ^/news/([0-9]+/){3}.+/.+\.shtml$
    # and only if it doesn't exist
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule .* /bling.cfm

I shortened the first pattern so it would fit on a line, but you may expand
it as you had it. You may also want to add the [R] flag to the last rule, so
it performs an external redirect to it. The original request is available in
the environment variable REQUEST_URI, or you could add it to the query
string of bling.cfm if you do an external redirect.

I have not tested it, but I have similar rules that work well. Joshua is the
mod_rewrite guru, so he may give some comments.

Robert Andersson

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message