Solved

Redirecting Single Page from HTTP to HTTPS

Posted on 2014-02-05
8
274 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
  • 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 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

10 Experts available now in Live!

Get 1:1 Help Now