httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joshua Slive" <>
Subject Re: [users@httpd] RewriteMap questions
Date Fri, 01 Jun 2007 12:57:06 GMT
On 5/31/07, Josh Trutwin <> wrote:
> On Thu, 31 May 2007 13:20:03 -0400
> "Joshua Slive" <> wrote:
> > Yes, but I was thinking of having your script just output the
> > /custom/404.php directly.
> Hoping this is my last question - I have the following .htaccess file:
> RewriteEngine On
> # Rewrite Map for Page Rewrites
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteCond %{REQUEST_FILENAME} !-l
> RewriteRule .* ${smc_rewriter:%{REQUEST_FILENAME}^%{REQUEST_URI}}
> [L,QSA]
> # Rewrite Map for old URL Redirects
> ReWriteCond %{REQUEST_FILENAME} sitepages/p.*.php$
> ReWriteCond %{QUERY_STRING} !redirect_to_new_url=yes
> ReWriteRule .*
> ${smc_rewriter:%{REQUEST_FILENAME}^%{REQUEST_URI}}?redirect_to_new_url=yes
> [R=301]
> The first block works well to rewrite URL's from a mapping program -
> e.g.:
> new_page_name.php => sitepages/pid123.php
> The second block is designed to send a 301 redirect to anyone that
> uses the old URL's (maybe via a bookmark or search result) which I
> also added to the map - this is supposed to redirect:
> sitepages/pid123.php => new_page_name.php?redirect_to_new_url=yes
> The query string bit is to avoid a loop.
> That piece works ok, but when I added this block, the first part now
> doesn't stop despite the [L] flag, it rewrites the new url to
> sitepages/pid123.php then the next block gets executed then the first
> one again, each request like this calls the program 3 times.

I can't tell at all what you are trying to accomplish here. Given you
have the second set of rules, why is the first set of rules necessary
at all? If people are redirected to the correct place, why do you then
need to remap internally?

Your problem with the [L] not working likely has to do with operating
in .htaccess files instead of the main server config. mod_rewrite
needs to reinject the request in order to make sure all the proper
rules are applied.


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