There are a few hints that the user is new to mod_rewrite and PCRE too: no
need to escape the '-' in an expression, not using a substring match with
the RewriteCond (or just anchoring it at the beginning), and you can match
^ instead of a wildcard. And for 301's, always test with curl to bypass
your browser cache.

On Sat, Feb 17, 2018 at 12:44 PM, Eric Covener <cove...@gmail.com> wrote:

> LogLevel rewrite:trace8 would help here.
>
> On Sat, Feb 17, 2018 at 11:22 AM, David Mehler <dave.meh...@gmail.com>
> wrote:
> > Hello,
> >
> > I'm trying to get apache 2.4 not to rewrite urls with
> > .well-known/acme-challenge in them. I do not want these urls
> > redirected to https but all other urls to do so. Everytime I think
> > I've got this renewing a letsencrypt certificate fails.
> >
> > If anyone sees a glaringly obvious error i'd appreciate knowing about it.
> >
> > Thanks.
> > Dave.
> > httpd.conf fragment
> > # Access to .well-known for acme-challenge keys
> >         <Directory "/usr/local/www/.well-known/">
> >            Options None
> >            AllowOverride None
> >            Require all granted
> >            Header add Content-Type text/plain
> > <LimitExcept GET POST HEAD>
> > Require all denied
> > </LimitExcept>
> >         </Directory>
> >
> > #
> > # Virtual host file
> >     # share well-known for renewal via Let's Encrypt!
> >     Alias "/.well-known/" "/usr/local/www/.well-known/"
> >
> >  <IfModule mod_rewrite.c>
> >       RewriteEngine On
> >       RewriteCond %(REQUEST_URI) !/\.well\-known/acme\-challenge/?.*
> >       RewriteCond %{HTTPS} off
> >       RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
> >     </IfModule>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
> > For additional commands, e-mail: users-h...@httpd.apache.org
> >
>
>
>
> --
> Eric Covener
> cove...@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
> For additional commands, e-mail: users-h...@httpd.apache.org
>
>

Reply via email to