0

我怎样才能做到这一点:

Redirect permanent /ANY_TWO_CHARACTERS/secure/ANY_PATH https://example.com/THE_ANY_TWO_CHARACTERS/secure/ANY_PATH

我试过了:

Redirect permanent /(..)/secure(.*) https://example.com/secure$1

它不工作。怎么了?

4

1 回答 1

1

您不能将正则表达式与Redirect指令一起使用,您需要使用RedirectMatch

RedirectMatch permanent ^/../secure/(.*)$ https://example.com/secure/$1

您的正则表达式将 a(..)作为第一个分组,因此$1将是那些“ANY_TWO_CHARACTERS”而不是“ANY_PATH”。


尝试:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^/?../clients/ https://example.com%{REQUEST_URI} [L,R=301]
于 2013-07-10T00:09:05.530 回答