doushang1964
doushang1964
2016-10-18 20:14

.htaccess正则表达式 - “关键字”样式重定向 - 语法?

  • redirect
  • apache
  • php

Problem: inbound outdated links to products that have been discontinued. Challenge: many variations with additional keywords, subcategories, etc.

Examples:

  • /somecategory/cool-widget-OLDNAME
  • /special_sale_on_OLDNAME_items
  • /category/subcat/subsubcat/morestuff/weird_keywords_OLDNAME

Needed solution: something that will catch the keyword "OLDNAME" *regardless of what it's surrounded by, and redirect to a specific page.

E.g. "RewriteRule ??????? OLDNAME ?????? http://www.example.com/newpage [L,NC,R=301]

The bold part is what I need help with.

Thanks in advance!

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答