hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : HTTP to HTTPS Redirect
Reply

Forum Jump

HTTP to HTTPS Redirect

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old
WHT Addict
 
Join Date: Apr 2010
Posts: 150

HTTP to HTTPS Redirect


Hi folks,

I had a script coded in CakePHP and I have just installed the SSL Cert on my particular page. I'm trying to create an HTTP to HTTPS redirect using the .htaccess file, but I only see the redirect on Google Chrome because Chrome automatically looks for the HTTPS. On all of the other browswers my redirect doesn't work.

My current .htaccess file looks like this:

# php_value memory_limit 256M

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>

-------------------------------------

I have tried using the following and variations of the following and nothing seems to work:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

-------------------------------------

Any suggestions?



Sponsored Links
  #2  
Old
Web Hosting Master
 
Join Date: Mar 2009
Location: Gods Own Country
Posts: 660
Try changing the condition to
Code:
RewriteCond %{HTTPS} off

__________________
Fabin Mundattil @ Xieles Support
High Quality Server Management | support @ xieles.com
http://xieles.com

  #3  
Old
WHT Addict
 
Join Date: Apr 2010
Posts: 150
Quote:
Originally Posted by fabin View Post
Try changing the condition to
Code:
RewriteCond %{HTTPS} off
That still doesn't work. It just sends the domain to http://www.domainname.com, not https://www.domainname.com.

Sponsored Links
  #4  
Old
Web Hosting Master
 
Join Date: Mar 2009
Location: Gods Own Country
Posts: 660
write it above all existing rewrite rules

__________________
Fabin Mundattil @ Xieles Support
High Quality Server Management | support @ xieles.com
http://xieles.com

  #5  
Old
WHT Addict
 
Join Date: Apr 2010
Posts: 150
Quote:
Originally Posted by fabin View Post
write it above all existing rewrite rules
I'm still getting the same result. Just sends me to http://www.domain....

  #6  
Old
Community Liaison 2.0
 
Join Date: Feb 2005
Location: Australia
Posts: 5,818
1. Clear your browser cache after each .htaccess edit - redirects can and will be cached.
2. Try a redirect to somewhere else (eg. http://google.com/?q=$1) just to make sure the rule is firing at all.

Also,
Quote:
Originally Posted by n0ts0smart View Post
My current .htaccess file looks like this:

# php_value memory_limit 256M

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
that looks like a recipe for an endless rewrite loop (request -> app/webroot/request -> app/webroot/app/webroot/request etc). You'd normally use a condition before that last rule, something like:
Code:
RewriteCond %{REQUEST_FILENAME} !-f
I'd wonder if mod_rewrite (and / or .htaccess) is actually disabled, except that presumably the site wouldn't work without this rule?

__________________
Chris

"Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter

Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
using htaccess to redirect from http to https. Please help! zomex Hosting Security and Technology 7 06-17-2009 08:08 AM
how to force redirect https to http grabmail Programming Discussion 6 12-13-2006 02:09 PM
Redirect from https >> http MarkerMart Programming Discussion 6 07-22-2006 04:16 AM
.htaccess redirect : http to https jon31 Programming Discussion 7 01-26-2006 11:27 PM
Redirect http to https l0ck_up Hosting Security and Technology 8 11-09-2004 12:41 AM

Related posts from TheWhir.com
Title Type Date Posted
Hostpoint AG Listing 2014-10-22 09:46:49
Hostpoint AG Listing 2014-10-22 09:46:50
PTisp Listing 2014-10-22 09:45:15
CubicWebs Listing 2014-10-22 09:48:49
Savings for Swashbucklers: Web Hosting Deals for Talk Like a Pirate Day Blog 2013-09-19 13:19:24


Tags
https, redirect, ssl

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
WHT Host Brief Email:

We respect your privacy. We will never sell, rent, or give away your address to any outside party, ever.

Advertisement:
Web Hosting News:
WHT Membership
WHT Membership



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?