Re: [users@httpd] Validity of regex in mod_alias context

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* <Ralph.Grothe@xxxxxxxxxxxxxx> wrote:

>         <IfModule mod_alias.c>
>             RedirectMatch 301 ^(?:[[:alpha:]]+://)?(.*)
> https://$1
>         </IfModule>
> 
> 
> But it doesn't work, and neither the httpd's access_log nor
> error_log (or their ssl_ namesakes)
> show up any hint why.
> 
> In mod_alias'es reference doc I couldn't find a note on what kind
> of regex classes are valid
> (e.g. simple ones like the Unix sed uses, or more advanced like
> Perl's e.g. \w).
> Probably the [:alpha:] isn't recognised at all.

httpd 2.x utilizes PCRE, so it's quite like perl (which doesn't know the
POSIX classes). More interesting for your case: RedirectMatch works (like
mod_rewrite) with the URL path only, so you need to use some other logic.

You could either use mod_rewrite to check if SSL is available, or, if
you want to avoid it, put the RedirectMatch into the HTTP VirtualHost only.

Side note: Try to avoid <IfModule> containers. They just hide useful errors
if the module is not loaded.

> Or could I refer to some server's environment variables like
> %{PROTO} (if such exists at all?)

No.

nd

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux