Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 902
  • Last Modified:

Forcing Apache to use HTTPS

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
the-miz
Asked:
the-miz
1 Solution
 
boon86Commented:
try this:

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

Open in new window

0
 
the-mizAuthor Commented:
Beautiful.  Worked!  Thanks a million
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now