Adam
Adam

Reputation: 3128

Redirect permanent (SSL)

How can I do this:

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

I tried:

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

It's not working. What's wrong?

Upvotes: 0

Views: 406

Answers (1)

Jon Lin
Jon Lin

Reputation: 143886

You can't use regular expressions with Redirect directive, you need to use RedirectMatch:

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

Your regex has a (..) as the first grouping, so $1 would have been those "ANY_TWO_CHARACTERS" instead of the "ANY_PATH".


Try:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^/?../clients/ https://example.com%{REQUEST_URI} [L,R=301]

Upvotes: 1

Related Questions