• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

Redirecting Single Page from HTTP to HTTPS

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
bhaf
Asked:
bhaf
  • 4
  • 3
1 Solution
 
GaryCommented:
Are you sure the file exists and is named exactly the same (including case and extension)
The code as is above is fine.
0
 
bhafAuthor Commented:
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
 
GaryCommented:
Dash makes no difference.
Can you provide a link?
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
bhafAuthor Commented:
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
 
GaryCommented:
Can you add in the redirect again, so I can quickly check.
0
 
GaryCommented:
I see you added the redirect and it seems to be working fine my end.
0
 
bhafAuthor Commented:
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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