Solved

Redirecting Single Page from HTTP to HTTPS

Posted on 2014-02-05
8
279 Views
Last Modified: 2014-02-05
I am trying to redirect HTTP requests for a single page on our web site to HTTPS. The page in question, which I'll call "example.html", is in the root folder of our site. I am not too familiar with this process, but from browsing the Internet, I came up with the following which I added to the ".htaccess" file in the root of our site:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^example\.html$ https://www.oursite.com/example.html [R=301,L]

Open in new window


Once I do this, attempts to reach this file, either via HTTP or HTTPS, result in the following error being displayed:

The requested page "/example.html" could not be found.

Can you point me in the right direction here?

Thanks,

bhaf
0
Comment
Question by:bhaf
[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
  • 4
  • 3
8 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 39837021
Are you sure the file exists and is named exactly the same (including case and extension)
The code as is above is fine.
0
 

Author Comment

by:bhaf
ID: 39837051
I double checked the file name including case and extension, and all looks good. However, the name does have a dash in it (like "example-file.html"). Does the dash need to be escaped in the RewriteRule?

I'll also check out the tutorial Chris posted.
0
 
LVL 58

Expert Comment

by:Gary
ID: 39837061
Dash makes no difference.
Can you provide a link?
0
Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

 

Author Comment

by:bhaf
ID: 39837345
Here is a link to the page in question on our site. Note that I set the .htaccess file back to the default to prevent problems for our clients, so you won't actually see the error.

http://www.celticcapital.com/celtic-login.html
0
 
LVL 58

Expert Comment

by:Gary
ID: 39837355
Can you add in the redirect again, so I can quickly check.
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39837423
I see you added the redirect and it seems to be working fine my end.
0
 

Author Comment

by:bhaf
ID: 39837441
Yeah, it is working okay here too. I wonder if it was some kind of caching issue on my end as my first attempt had an error in it. I closed browsers, deleted temp file, flushed DNS, etc. and it is working okay now.

In any case, thanks for helping me!

Bhaf
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

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…
Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

728 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