nicname Posted January 7, 2011 Share Posted January 7, 2011 At the Moment, SSL Redirects work this way: <VirtualHost IP:80> ServerName domain.tld ServerAlias alias.domain.tld ServerAdmin admin@domain.tld Redirect / https://domain.tld </VirtualHost> This works fine if you have set up your domain and your SSL cert etc right from the first place. But there's a Problem when you had your website since some years and choose to change your site into an ssl only site afterwards. Lets Pretend a user has folllowing bookmark: http://domain/subpage in this case the user would get redirected to: https://domainsubpage for an unexperienced user this could seem that the website is down. a better way would be to use this: <VirtualHost IP:80> ServerName domain.tld ServerAlias alias.domain.tld ServerAdmin admin@domain.tld <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://domain.tld%{REQUEST_URI} </IfModule> Redirect / https://domain.tld </VirtualHost> In this case the user woould be redirected to https://domain/subpage and if mod rewrite is not available, there is still the old call Link to comment Share on other sites More sharing options...
d00p Posted January 7, 2011 Share Posted January 7, 2011 equivalent "rewrites" for lighttpd and nginx would be? Link to comment Share on other sites More sharing options...
nicname Posted January 8, 2011 Author Share Posted January 8, 2011 According to the Lighty documentation this should work: http://redmine.lighttpd.net/wiki/1/HowToRedirectHttpToHttps $HTTP["host"] =~ "domain.tld" { url.redirect = ( "^/(.*)" => "https://domain.tld/$1" ) server.name = "domain.tld" } With nginx it should be: server { server_name domain.tld; location / { rewrite ^(.*) https://domain.tld$1 permanent; } } While i know that the lighty configuration works, i haven't tested the nginx one. Link to comment Share on other sites More sharing options...
d00p Posted January 8, 2011 Share Posted January 8, 2011 If you could now post that all on the bugtracker, that would be nice Link to comment Share on other sites More sharing options...
nicname Posted January 8, 2011 Author Share Posted January 8, 2011 Done, ID: 541 Link to comment Share on other sites More sharing options...
Question
nicname
At the Moment, SSL Redirects work this way:
This works fine if you have set up your domain and your SSL cert etc right from the first place.
But there's a Problem when you had your website since some years and choose to change your site into an ssl only site afterwards.
Lets Pretend a user has folllowing bookmark:
http://domain/subpage
in this case the user would get redirected to:
https://domainsubpage
for an unexperienced user this could seem that the website is down.
a better way would be to use this:
In this case the user woould be redirected to https://domain/subpage and if mod rewrite is not available, there is still the old call
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.