regex - .htaccess redirect of a url that has brackets -
i have url:
http://www.suplementospt.com/goldnutrition-pack-3x-mega-cla-(portes-gratis) and need redirect
http://www.suplementospt.com/goldnutrition-pack-3x-mega-cla its not working , think problem brackets.
my code:
rewriterule ^goldnutrition-pack-3x-mega-cla-(portes-gratis)?$ http://www.suplementospt.com/goldnutrition-pack-3x-mega-cla [r=301,l]
since .htaccess uses regex match urls , parentheses regex special characters, need escape them:
rewriterule ^goldnutrition-pack-3x-mega-cla-\(portes-gratis\)$ http://www.suplementospt.com/goldnutrition-pack-3x-mega-cla [r=301,l] also, don't forget enable rewrite engine placing following code @ top of .htaccess file.
rewriteengine on
Comments
Post a Comment