Solved

Forcing Apache to use HTTPS

Posted on 2011-09-02
3
878 Views
Last Modified: 2012-05-12
I have tried several attempts at forcing my RHEL 5 web server running PHP 5.3 and Apache 2.2.3 to always use HTTPS instead of HTTP.   I want wherever anyone goes or whatever anyone types into the address bar of the web browser to automatically use https://

I have tried the following without success:

RewriteCond %{HTTPS} off

RewriteCond %{HTTPS} !=on

RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

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

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

RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Need help!
0
Comment
Question by:the-miz
3 Comments
 
LVL 7

Accepted Solution

by:
boon86 earned 500 total points
ID: 36475105
try this:

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

Open in new window

0
 
LVL 76

Expert Comment

by:arnold
ID: 36475125
0
 

Author Comment

by:the-miz
ID: 36475144
Beautiful.  Worked!  Thanks a million
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now