Re: mod_rewrite infinite loop problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Apr 26 at 11:49 AM, Josua Silve
<jslive@xxxxxxxxx> wrote:

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

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:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux