Welcome to Dream.In.Code
Getting Help is Easy!

Join 105,405 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,786 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Transfer all visitor to HTTPS regardless of where they go on the domai

 
Reply to this topicStart new topic

Transfer all visitor to HTTPS regardless of where they go on the domai

barcand
post 1 Apr, 2008 - 08:54 AM
Post #1


New D.I.C Head

*
Joined: 1 Apr, 2008
Posts: 1

Hello,

Hopefully someone out there can provide some assistance. We have our site hosted with Network Solutions and a SSL with DigiCert. I need anyone going to DOMAIN.COM to always be redirected to HTTPS://DOMAIN.COM. Below is the code we have but unfortunately it gets caught into a continous loop.

CODE

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ [url=https://www.sharoncu.com/$1]https://www.sharoncu.com/$1[/url] [R=301,L]
User is offlineProfile CardPM

Go to the top of the page


someone1
post 28 Apr, 2008 - 12:13 PM
Post #2


New D.I.C Head

*
Joined: 28 Apr, 2008
Posts: 6

If you use ASP or PHP, then you can just put a check in the code to verify that the server port is 443 over 80, and if it is 80, force a redirect to port 443.

the rewrite engine can be very tricky to manipulate.

EDIT:

a quick google found me this:
CODE

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


This post has been edited by someone1: 28 Apr, 2008 - 12:15 PM
User is offlineProfile CardPM

Go to the top of the page

ibbie
post 7 Jul, 2008 - 11:26 AM
Post #3


New D.I.C Head

Group Icon
Joined: 7 Jul, 2008
Posts: 8



Dream Kudos: 75
My Contributions


QUOTE(someone1 @ 28 Apr, 2008 - 12:13 PM) *

If you use ASP or PHP, then you can just put a check in the code to verify that the server port is 443 over 80, and if it is 80, force a redirect to port 443.

the rewrite engine can be very tricky to manipulate.

EDIT:

a quick google found me this:
CODE

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



Tricky though it might seem, the apache rewrite engine is probably the better way, as far as overhead goes. No need to fire up any additional script/code.

Just my opinion, of course.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 8/20/08 05:10AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month