Reputation: 2058
I modified a few rewrite rules of my .htaccess file today as follows:
From
RewriteRule ^about-us.php(.*)$ /about$1 [R=302,NC,L]
RewriteRule ^contact-us.php(.*)$ /service$1 [R=302,NC,L]
RewriteRule ^countertop-electrics/blenders(.*)$ /beverages/blenders [R=302,NC,L]
To
RewriteRule ^about-us.php(.*)$ /about [R=302,NC,L]
RewriteRule ^contact-us.php(.*)$ /service [R=302,NC,L]
RewriteRule ^countertop-electrics/blenders(.*)$ /beverages/blenders [R=302,NC,L]
The goal was to redirect a product page such as "countertop-electrics/blenders/product1234.html" to a simple category page such as "beverages/blenders" due to a change in how products and categories are sorted. I did this by dropping the $1 or $ but now it seems none of the RewriteRules are working. How else might I accomplish this? Thank you.
Upvotes: 1
Views: 46
Reputation: 784928
Use .+
in your regex:
RewriteRule ^about-us\.php.*$ /about [R=302,NC,L]
RewriteRule ^contact-us\.php.*$ /service [R=302,NC,L]
RewriteRule ^countertop-electrics/blenders.+$ /beverages/blenders [R=302,NC,L]
QUERY_STRING
will be carried over to the new URI.
Upvotes: 1