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

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -