Álvaro G. Vicario
2012-03-27 10:44:41 UTC
Given a site that has URLs like these:
http://example.com/catalogue
http://example.com/catalogue/category-20
http://example.com/catalogue/customer-5
http://example.com/catalogue/category-20/customer-5
http://example.com/catalogue/customer-5/category-20
... is there a sensible Apache way to make internal redirects to:
http://example.com/catalogue.php
http://example.com/catalogue.php?category_id=20
http://example.com/catalogue.php?customer_id=5
http://example.com/catalogue.php?category_id=20&customer_id=5
http://example.com/catalogue.php?customer_id=5&category_id=20
...?
My attempts are basically getting me nowhere:
RewriteRule ^(.*/)category-(\d+)(.*)$ $1$3?category_id=$2 [QSA]
RewriteRule ^(.*/)customer-(\d+)(.*)$ $1$3?customer_id=$2 [QSA]
RewriteRule ^catalogue/?$ catalogue.php [L,QSA]
# Request exceeded the limit of 10 internal redirects due to probable
# configuration error. Use 'LimitInternalRecursion' to increase the
# limit if necessary
RewriteRule ^(.*/)category-(\d+)(.*)$ $1$3?category_id=$2 [QSA]
RewriteRule ^(.*/)customer-(\d+)(.*)$ $1$3?customer_id=$2 [QSA]
RewriteRule ^catalogue/? catalogue.php [L,QSA]
# Matches everything that starts with /catalogue (not intended)
It'd though it'd be a common task but I've been totally out of luck in
Google.
http://example.com/catalogue
http://example.com/catalogue/category-20
http://example.com/catalogue/customer-5
http://example.com/catalogue/category-20/customer-5
http://example.com/catalogue/customer-5/category-20
... is there a sensible Apache way to make internal redirects to:
http://example.com/catalogue.php
http://example.com/catalogue.php?category_id=20
http://example.com/catalogue.php?customer_id=5
http://example.com/catalogue.php?category_id=20&customer_id=5
http://example.com/catalogue.php?customer_id=5&category_id=20
...?
My attempts are basically getting me nowhere:
RewriteRule ^(.*/)category-(\d+)(.*)$ $1$3?category_id=$2 [QSA]
RewriteRule ^(.*/)customer-(\d+)(.*)$ $1$3?customer_id=$2 [QSA]
RewriteRule ^catalogue/?$ catalogue.php [L,QSA]
# Request exceeded the limit of 10 internal redirects due to probable
# configuration error. Use 'LimitInternalRecursion' to increase the
# limit if necessary
RewriteRule ^(.*/)category-(\d+)(.*)$ $1$3?category_id=$2 [QSA]
RewriteRule ^(.*/)customer-(\d+)(.*)$ $1$3?customer_id=$2 [QSA]
RewriteRule ^catalogue/? catalogue.php [L,QSA]
# Matches everything that starts with /catalogue (not intended)
It'd though it'd be a common task but I've been totally out of luck in
Google.
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--