How can I use htaccess to redirect paths with a wildcard character

后端 未结 2 1699
别跟我提以往
别跟我提以往 2020-12-10 01:28

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 UR

相关标签:
2条回答
  • 2020-12-10 01:50

    You can do with a few rewrite rules:

    RewriteEngine on
    RewriteRule ^calendar-for-groups/(.*)   /events [R=301,L]
    
    0 讨论(0)
  • 2020-12-10 02:04

    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]
    
    0 讨论(0)
提交回复
热议问题