【问题标题】:Trying to redirect anything after the full URL without /68 for example例如,尝试在没有 /68 的完整 URL 之后重定向任何内容
【发布时间】:2014-11-22 17:16:35
【问题描述】:

我需要删除 URL 末尾的任何内容,例如以下示例,不带 /68 或任何数字 ID

https://www.website.com/forum/making-coffee/68

https://www.website.com/forum/making-coffee

我已搜索但无法使重定向正常工作。

有什么想法吗?

【问题讨论】:

    标签: apache .htaccess url redirect


    【解决方案1】:

    您可以在根 .htaccess 中使用此规则

    RedirectMatch 301 ^/(.+?)/[0-9]+$ /$1
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-30
      • 2022-01-15
      • 1970-01-01
      • 2018-06-13
      • 2016-08-21
      • 2021-05-01
      相关资源
      最近更新 更多