regex - 301 redirect to full path -
i have lot incorrect links, links pointing to:
while correct path is
there hundreds of those...how 301 redirect wrong links correct links?
thank in advance
you can try code:
rewritebase / rewriterule ^tags/([^/]+)$ /tags/$1/ [l,r=301]
rewritebase /
tells apache uri starts/
. if site in subfolder should writerewritebase /subfolder/
instead.^tags/([^/]+)$
: search uri startingtags/
followed[^/]+
means characters except/
.( )
around there capture , use in redirection. capture characters not/
betweentags/.../
in uri. (^
marks start of string while$
marks end)/tags/$1/
redirection.$1
means first previous captured element (the 1 witch between( )
).[l,r=301]
indicates apache should stop process other rules , redirect 301 header code.
Comments
Post a Comment