且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

.htaccess重定向部分网址格式

更新时间:2023-11-27 20:55:46

尝试:

RedirectMatch 301 /CORE_Testing_5010$ /core-phase

正则表达式模式忽略了最后一个 / 之前的所有内容,因此 /前面可以有任何内容CORE_Testing_5010

The regex pattern ignored everything before the last /, so there can be anything in front of /CORE_Testing_5010.

如果您有重写规则,并使用mod_alias( RedirectMatch )导致冲突,那么您可以坚持使用mod_rewrite:

If you have rewrite rules, and using mod_alias (the RedirectMatch) is causing conflicts, then you can stick with mod_rewrite:

RewriteRule /?CORE_Testing_5010$ /core-phase [L,R=301]

,它必须在任何进行路由的规则之前。

and it needs to be before any rules that do routing.