HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   General (http://www.howtoforge.com/forums/forumdisplay.php?f=25)
-   -   http to https redirection (http://www.howtoforge.com/forums/showthread.php?t=44209)

neutrino 19th March 2010 10:40

http to https redirection
 
Hello,

I'm currently trying to redirect the url http://mail.server.com to https://mail.server.com

I've tried all the options in ISPCONFIG (no flag, R, L, RL) and none off them actually work, Firefox / IE / Opera, there is no browser that accepts the rewrite rule.

The code produced by ispconfig is the next one :

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mail.server.com [NC]
RewriteRule ^/(.*)$ https://mail.server.com/$1 [R,L]


What I want to do, is to replace the ISPconfig code with something that works like :

RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]


Problem is, each time I'll perform a change on the site, my code will be erased by the standard ispconfig code.

How can I change this ? I suppose I have to change some master code of ISPconfig, but I don't really like that idea, because it always causes trouble when updating to a new version.

Can a fix be expected in a future version of ISPconfig maybe ?

till 19th March 2010 10:44

Just add the lines:

RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

in the apache directives field of the website settings and click on save.

neutrino 19th March 2010 10:54

That works perfectly well, I forgot that option !

Thanks a lot till :)

DaRKNeSS666NL 22nd May 2010 23:14

Quote:

Originally Posted by till (Post 222632)
Just add the lines:

RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

in the apache directives field of the website settings and click on save.

Does this work for all or must I chance something in those lines?
I want to use https://webmail.mydomain.com all the time somebody uses web-mail.

Hans 23rd May 2010 07:23

Quote:

Does this work for all or must I chance something in those lines?
Yes that works, and also:

Code:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}


DaRKNeSS666NL 23rd May 2010 09:53

Witch one is the preferred way to do it?

Eleven Cool 7th February 2013 06:52

Feature Request: ModRewrite Is Not Optimal For This
 
Is there any chance that the option to make a whole site SSL only can be added to ISPConfig 3 in a future release?

Having this written into the vhost file is not only the "proper" way to do it but also would be a performance gain:

Code:

<VirtualHost *:80>
  ServerName www.example.com
  Redirect permanent / https://example.com
</VirtualHost>


till 7th February 2013 10:23

No need to edit or create a vhost file as you can do this from within ispconfig. Go to the sites module, edit the website and go to the options tab and enter the following lines in the apache directives field:

Code:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

and press save.

Eleven Cool 7th February 2013 12:13

That works too.

I wasn't suggesting that anyone modify the vhost directly I'm just making a feature request for a site option that basically says "Hey ISPConfig, I want this entire site to be SSL only".

Having that option would allow ISPConfig to then automatically write that very simple *:80 vhost entry, which not only handles the SSL only part, but also eliminates a full fledged *:80 vhost entry that never gets used but still has to get loaded into memory. This would also eliminate any need for adding any redirects by the user.

Not a crucial feature request or anything, but it would be nice. :cool:


All times are GMT +2. The time now is 16:38.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.