Freelance - Mortgage Calculator - Bad Credit Loan - Discount Magazine Subscriptions - Personal Loans

PDA

View Full Version : Quick .htaccess Question


T0PS3O
Mar 18th 2005, 2:00 am
Obviously not an expert on this...

redirect 301 /index.php?cPath=21_22_21 http://www.my-domain.co.uk/product-c-21.html

Why would this not work?

Can you not 301 variable specific (cPath=21_22_21) URLs?

piniyini
Mar 18th 2005, 2:09 am
RewriteRule index.php?cPath=21_22_21$ /product-c-21.html [R=301,L]

htaccess 301 (http://www.toseef.com/200501-php-htaccess-301-redirect) (my site :p )

J.D.
Mar 18th 2005, 6:17 am
Redirect works with paths. That is, if Apache matches the beginning of the actual path to the one specified in Redirect, it will replace the matched part in the actual path and will leave the tail intact.

As for RewriteRule, it will not match the query string. You need to use RewriteCond for this:

RewriteCond %{QUERY_STRING} ^cPath=21_22_21$
RewriteRule ^index.php$ http://www.my-domain.co.uk/product-c-21.html [R=301,L]

J.D.