?
Solved

Redirecting Single Page from HTTP to HTTPS

Posted on 2014-02-05
8
Medium Priority
?
282 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

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 2000 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

Optimum High-Definition Video Viewing and Control

The ATEN VM0404HA 4x4 4K HDMI Matrix Switch supports 4K resolutions of UHD (3840 x 2160) and DCI (4096 x 2160) with refresh rates of 30 Hz (4:4:4) and 60 Hz (4:2:0). It is ideal for applications where the routing of 4K digital signals is required.

Question has a verified solution.

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

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

777 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