httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Bylsma <>
Subject Re: [users@httpd] mod_rewrite infinite loop problem
Date Mon, 28 Apr 2008 15:47:24 GMT
On Sat, Apr 26 at 11:49 AM, Josua Silve
<> wrote:

> I would probably avoid the program rewrite map (which is a potential

Agreed, unfortunately, neither of your suggestions can be implemented in
my environment:

> One very simple one would be to make your RewriteRule something like
RewriteRule .* /product/{sku_to_path:%1}?rewritten [QSA,R=301,L]

This will not work if a URL that's correct today (and makes its way into
the Google index with the "rewritten" query param) is changed tomorow.

> Another solution would be to have two text maps: sku_to_path and
another listing only the sku's that need to be changed.

This would be the best, but unfortunately, our product information
system does not keep "last modified" on the product path, much less a
history of what values used to be.  I just don't have data available to
create this map.

===another solution===

I have thought of another solution that avoids the rewrite program.  I
could make a rewrite map that contains every valid product URL and maps
it to 1.  e.g. /etc/httpd/good_product_urls.txt

/product/New_Path_To_Product1?sku=000001 1

Then add a rule like:

RewriteMap good_product_urls txt:/etc/httpd/good_product_urls.txt

# skip product path rewriting if the URL is already correct
RewriteCond %{REQUEST_URI}  ^/product
RewriteCond ${good_product_urls:%{REQUEST_URI}?%{QUERY_STRING}} 1
RewriteRule ^ - [S=1]

...Rule for product path rewrite


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