Re: virtual host double slash effect, need solution

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

 



Redirect is simpler as you can see, it redirects everything, it has a
regex version called RedirectMatch. Both are provided by mod_alias.

RewriteRule is for more complex things, yes it can redirect too, but
as you have seen yourself, the most simple thing can bring confusion.
RewriteRute is provided by mod_rewrite and should be used only when
there is no simpler option for the sake of simplicity.

The rule of thumb is to go for simpler configuration directives
whenever possible, and a simple redirection like that in virtualhost
is a task perfect for Redirect.

2017-07-16 19:14 GMT+02:00 David Mehler <dave.mehler@xxxxxxxxx>:
> Hello,
>
> Thanks. I'll try the rewrite redirect.
>
> With regards the redirect option, the simpler way, does it do the tls
> conversion unsecure to secure? What would the advantages/disadvantages
> of rewrite and redirect?
>
> Thanks.
> Dave.
>
>
> On 7/16/17, Daniel <dferradal@xxxxxxxxx> wrote:
>> And while at it why not use simple Redirect's since your config fits
>> perfectly to use them:
>>
>> <VirtualHost *:80>
>>     ServerName example.com
>>     Redirect / http://www.example.com/
>> </VirtualHost>
>>
>> simpler, gets the job done, and you don't need a cannon to smash a fly.
>>
>>
>> 2017-07-16 17:48 GMT+02:00 Luca Toscano <toscano.luca@xxxxxxxxx>:
>>> Hi David,
>>>
>>> 2017-07-15 3:11 GMT+02:00 David Mehler <dave.mehler@xxxxxxxxx>:
>>>>
>>>> Hello,
>>>>
>>>> I'm running Apache 2.4 on a FreeBSD 10.3 system, with several virtual
>>>> hosts. My goal is to have all of them completely ssl, except for the
>>>> .well-known area needed for letsencrypt.
>>>>
>>>> <VirtualHost *:80>
>>>>     ServerName example.com
>>>>     RewriteEngine On
>>>>     RewriteRule ^/?(.*) http://www.example.com$1 [R,L]
>>>> # This line also produces the double slash effect
>>>> #     RewriteRule ^/?(.*) http://www.example.com/$1 [R,L]
>>>> </VirtualHost>
>>>>
>>>
>>> Have you tried with RewriteRule ^(.*)$ https://www.example.com$1 [R=301,L]
>>> ?
>>> (note also the https, IIUC you need to force TLS).
>>>
>>> Hope that helps,
>>>
>>> Luca
>>>
>>
>>
>>
>> --
>> Daniel Ferradal
>> IT Specialist
>>
>> email         dferradal at gmail.com
>> linkedin     es.linkedin.com/in/danielferradal
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
>> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
>



-- 
Daniel Ferradal
IT Specialist

email         dferradal at gmail.com
linkedin     es.linkedin.com/in/danielferradal

---------------------------------------------------------------------
To unsubscribe, e-mail: users-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