regex - Htaccess Not Working - Redirect 301 -
due bad urls, generated links don't work , want redirect them 301 redirect clear webmaster tools issues google.
so, have url this:
http://www.site.com/subdomain/z//-products *note subdomain variable, rest of url static.
as side note, url makes no sense, that's why want redirect it. should this:
http://www.site.com/bedroom/z/12345/bedroom-furniture-products anyway, had these bad urls being dynamically generated. we've fixed them, google picked them , keeps trying crawl them. want create htaccess rule 301 redirect them , issue should wash out eventually.
here's tried htaccess no avail:
^(.*)/n//-products/?$ $1 [r=301,b] i've tried kinds of permutations of , it's not working. suspected entity escaping issue, research led me add [b], didn't seem work either. it's redirect rule working, it's redirecting original page.
what missing here?
i believe anubhava correct, in there inconsistency between sample url describe /subdomain/z//-products , rewriterule attempted apply. not sure if typo or not. may case copy/paste operation added "/n" literally.
anyhoo, let presume want make rule work /subdomain/z//-products:
rewriterule ^/([^/]+)/z//\-products/?$ http://www.site.com/$1 [r=301] see the example 1 slides of pdf quick first portion. faster using (.*).
we literally match z character , surrounding slashes. escape - character, rest of url , optionally match trailing slash. use, if memory serves correctly, "external" style redirect robots re-open separate http connection, appending matched backreference, , hand off status code.
let me know if works.
Comments
Post a Comment