如何重定向.htaccess中以相同单词开头的每个链接?
我需要重定向一个新的链接与同一个词开始了很多网址 例如:如何重定向.htaccess中以相同单词开头的每个链接?,.htaccess,redirect,.htaccess,Redirect,我需要重定向一个新的链接与同一个词开始了很多网址 例如: 重定向301/old-text-1//新链接/ 重定向301/old-text-2//新链接/ 重定向301/old-text-3//新链接/ 重定向301/old-text-4//新链接/ 重定向301/old-text-5//新链接/ 我能以更好的方式重定向所有这些链接吗 我试过: RewriteRule ^/old-text(.*)$ /new-link/ [R=301,L] 但是它不起作用。在.htaccess上下文中使用
- 重定向301/old-text-1//新链接/
- 重定向301/old-text-2//新链接/
- 重定向301/old-text-3//新链接/
- 重定向301/old-text-4//新链接/
- 重定向301/old-text-5//新链接/
RewriteRule ^/old-text(.*)$ /new-link/ [R=301,L]
但是它不起作用。在
.htaccess
上下文中使用RewriteRule
指令时,需要删除尾部斜杠
RewriteRule ^old-text(.*)$ /new-link/ [R=301,L]