apache - How to redirect URLs with the same substring to a new page -
how redirect urls same substring new page
i have redirect around 200 urls of type:
redirect 301 /folder/page1.html http://domain.com/new-a redirect 301 /folder/xyz_page1.html http://domain.com/new-a redirect 301 /folder/page2.html http://domain.com/new-b redirect 301 /folder/xyz_page2.html http://domain.com/new-b
“page1.html”/ “xyz_page1.html” “page2.html”/ “xyz_page2.html” similar besides string “xyz_”
if write redirect sort of wildcard string “xyz_”
redirect 301 /folder/*page1.html http://domain.com/new-a redirect 301 /folder/*page2.html http://domain.com/new-b
instead of 200 urls, had redirect half of them.
any suggestion? thank you.
use rewriterule
. make sure have mod-rewrite enabled , put in .htaccess
file @ site root
rewriteengine on rerwriterule folder/.*page1\.html$ http://domain.com/new-a [r,l] rerwriterule folder/.*page2\.html$ http://domain.com/new-b [r,l]
Comments
Post a Comment