Trying to redirect from http to https using .htaccess

Hi there,

One of my clients purchased a 1-year SSL certificate for one of his sites.  It's a one-click checkout process.  He had some development work done to hook it up to authorize.net's payment gateway.  Anyways, I registered the certificate and I am currently trying to force a redirect to https if someone tries to access the http URL for the checkout page.

This is what I have :

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule http://www.somesite.com/checkout.php https://%{HTTP_HOST}%{REQUEST_URI}

Open in new window


It's not working as far as I can tell.  I've cleared the browser cache multiple times and it's a no-go.  

Am I doing this right?
duder78Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

grahamnonweilerCommented:
Are you sure "mod-rewrite" is enabled in Apache?

Do you have any other .htaccess files working?

Also try  either of the below:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$  https://%{HTTP_HOST}/$1 [L,NC]

Open in new window

- or -
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^/checkout.php$  https://%{HTTP_HOST}/checkout.php [L, NC]

Open in new window

Frederic SuneCEO, IT in MIND inc.Commented:
Try this:

RewriteCond %{SERVER_PORT} =80
RewriteRule ^checkout\.php$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,NE,L]

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
arober11Commented:
Or if your after a rule that will work in either the httpd.conf or a .htaccess file and is not case sensitive try:

RewriteEngine On
RewriteCond %{HTTPS}        off
RewriteCond %{REQUEST_URI}  ^/checkout\.php$        [NC]
RewriteRule .               https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Open in new window

duder78Author Commented:
That did it, perfect.  Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.