Creating a 301 redirect with regEx till forward slash -


i'm rebuilding website , changing cms. former cms had weird url structure - adding post id in end of url forward slash. example:

www.mydomain/category/someurl/54 

i'd create 301 redirects in .htaccess regex new cms (wordpress). how create pattern match old cms url new url removing last forward slash , id in url?

basically should this:

301, www.mydomain/category/someurl/54 www.mydomain/category/someurl 

you can place rule very first rule below rewriteengine line.

rewriteengine on  rewriterule ^(.+?)/[^/]+/?$ /$1 [l,r=301] 

Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -