Solved

How to use htaccess to force https on the homepage only

Posted on 2008-10-27
1
436 Views
Last Modified: 2008-10-28
I want to force https:// on the index page only of a site.
Right now, I am using htaccess to append www to the url:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.mysite.com$
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301]

How do I force ssl to only the index page? There is a login box on this page and I need it to be secure, but the rest of the pages, I dont want to force ssl (I will control the rest through navigation).
0
Comment
Question by:lexo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 43

Accepted Solution

by:
ravenpl earned 500 total points
ID: 22819602
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.mysite.com$
RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301]

RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} ^(/|/index.php|/index.html)$
RewriteRule .* https://www.mysite.com%{REQUEST_URI} [L,R=301]
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

688 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