代码之家  ›  专栏  ›  技术社区  ›  Teej

将动态页面重定向到新的动态页面

  •  0
  • Teej  · 技术社区  · 15 年前

    我的网站具有以下url结构:

    /shoe/view/3
    /shoe/view/5
    /shoe/view/86
    /shoe/view/124
    

    我想使用htaccess将所有内容重定向到一个新结构,如下所示:

    /item/3
    /item/5
    /item/86
    /item/124
    
    2 回复  |  直到 15 年前
        1
  •  1
  •   Quentin    15 年前

    这应该可以做到:

    RedirectMatch 301 \/shoe\/view\/(.*)$ http://www.example.com/item/$1
    
        2
  •  1
  •   Pascal MARTIN    15 年前

    RewriteEngine on
    RewriteRule ^shoe/view/(.*)$ /item/$1 [R=301]