Re: [users@httpd] Rewrite http to https

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

 




Huesser Peter wrote:
>
> Hello
>
> This question was often asked before but I did not get any solution to
> work:
>
> I want to rewrite all request to
> “http:virtual.server.domain/path/file.html” to
> “https://virtual.server.domain/path/file.html”;. One of the solutions I
> found is:
>
> RewriteEngine On
>
> RewriteCond %{HTTPS} off
>
> Rewrite ^/path/file.html https://%{HTTP_HOST}/path/file.html
>
> I but this in the htaccess file of the DocumentRoot of the virtual
> server and also in the main httpd.conf file of the webserver. Both did
> not work. So I tried the following:
>
> RewriteEngine On
>
> RewriteCond %{HTTPS} off
>
> Rewrite (.*) https://%{HTTP_HOST}%{REQUEST_URI}
>
> which should rewrite all the URLs of the specific virtual host. It did
> not work either. Many people found this a good solution for the
> problem therefore I guess I am still missing something. Any idea ?
>
> Thanks’ in advance for any help
>
> Pedro
>
On the port 80 virtual host, I have:

RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) https://I_USE_A_HARDCODED_HOSTNAME/$1 [L,R]

Not sure if it's the best way, but it works for me... We don't use the
variable instead of a hard coded name for other reasons but should work
otherwise...


-- 

°(((=((===°°°(((===========================================

begin:vcard
fn:Ricardo Stella
n:Stella;Ricardo
org:Rider University
adr;dom:;;2083 Lawrenceville Rd;Lawrenceville;NJ;08648
version:2.1
end:vcard


---------------------------------------------------------------------
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