本文介绍了如何使用htaccess重定向带有通配符的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个最近升级的网站.旧站点的日历创建了数百个页面,新站点上的日历已替换为事件页面,并且这些日历URL不再存在.几个月以来,我一直在搜索引擎搜索像这样的不再存在的页面.
I have a site I recently upgraded. The old site had a calendar that created hundreds of pages, on the new site this has been replaced by an events page and those calendar URL's no longer exist. For months now I have been getting search engines pounding no longer existent pages like these ones.
例如:
page not found calendar-for-groups/2012-09-15/1093 page not found calendar-for-groups/2011-W09/77 page not found calendar-for-groups/2011-W27/77 page not found calendar-for-groups/2012-06-29/1093如何使用htaccess将任何www.mywebsite/calendar-for-groups/*请求重定向到www.mywebsite/events?
How can I use htaccess to redirect any www.mywebsite/calendar-for-groups/* request to www.mywebsite/events?
推荐答案您可以使用mod_alias的RedirectMatch指令:
RedirectMatch 301 ^/calendar-for-groups/.*$ www.mywebsite/events或使用mod_rewrite:
RewriteRule ^calendar-for-groups/ www.mywebsite/events [R=301,L]更多推荐
如何使用htaccess重定向带有通配符的路径
发布评论