php - How can I 301 Redirect and Change Url with .htaccess? -


i discovered have duplicate pages need remove pages should not exist indexed , generating small amounts of traffic. want redirect urls original ones.

http://www.example.com/buy-something.php

to

http://www.example.com/something.php

i need remove "buy-" in urls , make sure page redirected proper page. here have far:

#301 redirect buy- none rewriterule ^([a-za-z\.]+).php$  /buy-$1.php  [l,r=301] 

but nothing pages should redirected , adds loop of buy-buy-buy-buy-buy-buy- other pages , causes them time out. have tried few other variations no prevail.

your appreciated.

you mixed syntax, right redirecting .php /buy-.php, since want other way arround try:

redirectrule ^buy-([a-za-z\.]+).php$  /$1.php  [l,r=301] 

that should take buy-*.php domains , redirect them *.php code 301.

source: http://httpd.apache.org/docs/current/mod/mod_rewrite.html


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -