简体   繁体   English

301重定向的htaccess重写规则

[英]htaccess Rewrite Rule for 301 Redirect

I'm horrible with regex/htaccess and I need help to make this 301 rewrite rule: 我对regex / htaccess感到恐惧,并且需要帮助来制定此301重写规则:

Transform: 转变:

domain.com/something/something/fixed_text-name domain.com/something/something/fixed_text-name

to

domain.com/fixed_text/name domain.com/fixed_text/name

Note : 'fixed_text' is always the same. 注意 :“ fixed_text”始终相同。

Thanks for the help. 谢谢您的帮助。

You can probably use this rule in root .htaccess: 您可能可以在根.htaccess中使用此规则:

RewriteEngine On

RewriteRule ^[^/]+/[^/]+/(fixed_text)-([^/]+)/?$ /$1/$2 [L,NC,R=301]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM