regex - Redirect by removing last two letters -
so been trying figure 1 out in htaccess. have duplicated posts looking this:
http://test.se/bank/test-b/ http://test.se/bank/test-b-2/
i redirect posts ending -2 first url.
ive got code far:
options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritebase / rewriterule ^-2/(.*)$ /$1 [l,r=301]`
your regex not right want grab before -2
not after it:
options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritebase / rewriterule ^(.+?)-2$ /$1 [l,r=301]
Comments
Post a Comment