DevHeads.net

alias and redirect

Users!

...
Alias "/.well-known/acme-challenge/" "/var/run/acme/acme-challenge/"
<Directory "/var/run/acme/acme-challenge">
AllowOverride None
# Options None
Options All +FollowSymLinks
Require all granted
</Directory>

RedirectPermanent / <a href="https://subdomain.domain.ext/" title="https://subdomain.domain.ext/">https://subdomain.domain.ext/</a>
...

This configuration redirects also
<a href="http://subdomain.domain.ext/.well-known/acme-challenge/" title="http://subdomain.domain.ext/.well-known/acme-challenge/">http://subdomain.domain.ext/.well-known/acme-challenge/</a>
to
<a href="https://subdomain.domain.ext/.well-known/acme-challenge/" title="https://subdomain.domain.ext/.well-known/acme-challenge/">https://subdomain.domain.ext/.well-known/acme-challenge/</a>

How can I bring about that
<a href="http://subdomain.domain.ext/.well-known/acme-challenge/" title="http://subdomain.domain.ext/.well-known/acme-challenge/">http://subdomain.domain.ext/.well-known/acme-challenge/</a>
is not redirected, but
<a href="http://subdomain.domain.ext/" title="http://subdomain.domain.ext/">http://subdomain.domain.ext/</a>
and
<a href="http://subdomain.domain.ext/other" title="http://subdomain.domain.ext/other">http://subdomain.domain.ext/other</a>
is redirected to
<a href="https://subdomain.domain.ext/" title="https://subdomain.domain.ext/">https://subdomain.domain.ext/</a>
and
<a href="https://subdomain.domain.ext/other" title="https://subdomain.domain.ext/other">https://subdomain.domain.ext/other</a>?

Kind regards,
Jaap van Wingerde.

Comments

Re: alias and redirect

By Eric Covener at 09/09/2018 - 11:10

On Sun, Sep 9, 2018 at 9:07 AM Jaap van Wingerde
< ... at vanwingerde dot nl> wrote:
I would suggest wrapping it in <if> in 2.4 to restrict the Redirect.
It's a bit more tidy than a negative regex or switching to
mod_rewrite.
Some example expressions in an if are here:
<a href="https://httpd.apache.org/docs/2.4/expr.html#examples" title="https://httpd.apache.org/docs/2.4/expr.html#examples">https://httpd.apache.org/docs/2.4/expr.html#examples</a>