Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

For example:

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

How can I use htaccess to redirect any www.mywebsite.com/calendar-for-groups/* request to www.mywebsite.com/events?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
379 views
Welcome To Ask or Share your Answers For Others

1 Answer

You could use the RedirectMatch directive of mod_alias:

RedirectMatch 301 ^/calendar-for-groups/.*$ http://www.mywebsite.com/events

Or with mod_rewrite:

RewriteRule ^calendar-for-groups/ http://www.mywebsite.com/events [R=301,L]

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...