regex - .htaccess rewrite product URL to root category -
having problems writing rewrite rule, regex skills bit lacking i'm reading tutorials , working off examples... can't seem it...
# /boys/footwear/socks/surfs_up_kids_three-pack_socks/product.aspx?productid=4407&deptid=365 # /boys/footwear.html rewriterule ^.*boys/footwear/socks/([^/]+)/product\.aspx([^/]+)$ /boys/footwear.html [r=301,l,nc]
the idea match products have boys/footwear/socks , product.aspx assigned in url. though want able tweak depending on scenario... may not product.aspx
what doing wrong 1st off... cause thats annoying part. i've followed dozens of tutorial , examples no luck... , know smallest thing...
thanks everyones input!
update
this suppose work according to: http://htaccess.madewithlove.be/ (but not work on website?)
rewriterule ^(.*)boys/footwear/socks/(.*)/product.aspx(.*)$ $1boys/footwear/socks.html [r=301,l,nc]
don't know rewrite regex usage, since nobody answered yet, thought might steer in right direction.
# /boys/footwear/socks/surfs_up_kids_three-pack_socks/product.aspx?productid=4407&deptid=365 # /boys/footwear.html rewriterule ^boys/footwear/socks/([^/]+)/product.aspx([^/]+)$
just need escape dot between product , aspx.
add capture groups necessary make replacement.
^.*/boys/footwear/socks/[^/]+/product\.aspx[^/]+$
Comments
Post a Comment