httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Darek Czarkowski <dczarkow...@infinitesource.ca>
Subject Re: [users@httpd] Rewrite http to https
Date Thu, 21 Sep 2006 00:16:04 GMT
On Wed, 2006-09-20 at 17:03 -0400, Ricardo Stella wrote:
> 
> 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...
> 
> 
> ---------------------------------------------------------------------
> 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@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

If you are looking for particular url, this should work:

RewriteEngine on
RewriteRule ^(.*/somepath/securefile.*) https://%{SERVER_NAME}$1 [R,L]


-- 
Darek Czarkowski
Ph: 604 294 6557 (Ext. 113)
Fx: 604 294 6507
www.infinitesource.ca
darekc at infinitesource dot ca


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message