[SOLVED] Forcing SSL over https

Support for security such as Firewalls and securing linux
User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Forcing SSL over https

Post by TrevorH » 2012/02/18 00:51:00

Just confirm, you can now successfully connect to https itself without using the redirect?

DarkSnake-Kobra
Posts: 27
Joined: 2011/08/06 18:23:49

Re: Forcing SSL over https

Post by DarkSnake-Kobra » 2012/02/18 17:50:42

Yes. https is working now if I type in https.

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Forcing SSL over https

Post by TrevorH » 2012/02/18 19:34:12

And what do you currently have to attempt the redirection? Anything?

DarkSnake-Kobra
Posts: 27
Joined: 2011/08/06 18:23:49

Re: Forcing SSL over https

Post by DarkSnake-Kobra » 2012/02/19 22:05:52

Nothing. I just manually type https.

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Forcing SSL over https

Post by TrevorH » 2012/02/19 22:48:49

So you want to add something to the virtual host definition you're using that does something like

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

DarkSnake-Kobra
Posts: 27
Joined: 2011/08/06 18:23:49

Re: Forcing SSL over https

Post by DarkSnake-Kobra » 2012/02/20 20:29:27

Sorry for my ignorance, but what configuration file do I put this in?

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Forcing SSL over https

Post by TrevorH » 2012/02/20 21:34:56

Where you put it depends on what you want to affect. For example, if you have separate VirtualHost sections then putting it inside one of those will affect only that Virtual Host. If you do not have any virtual hosts defined then adding it to the main /etc/httpd/conf/httpd.conf file somewhere after the line in the default one that says "### Section 2: 'Main' server configuration" and before the one that says "" should work for the default site. You can test the syntax of a change to httpd.conf by running

[code]
service httpd configtest
[/code]

and once it says "Syntax OK" you can reload it with `service httpd reload`.

DarkSnake-Kobra
Posts: 27
Joined: 2011/08/06 18:23:49

Re: Forcing SSL over https

Post by DarkSnake-Kobra » 2012/02/23 17:16:55

Awesome thank you very much it works. :-)

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: [SOLVED] Forcing SSL over https

Post by pschaff » 2012/02/24 02:57:19

Thanks for reporting back. At long last marking this thread [SOLVED] for posterity.

Post Reply