HTTP to HTTPS

Status
Not open for further replies.

Mike

New member
Jun 27, 2006
6,777
116
0
51
On the firing line
Using .htaccess to accomplish this now

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

And it works fine, except all the internal links still show http. No big deal, but the problem comes in with the graph. Oh, did I mention this is on my Prosper202 install? No? Sorry.

Anyhow, everything else works fine except the graph. Do I just need to manually go change all the links that pull the graph? Or is there something I can add to the .htaccess to make it work?
 


You might want this test to redirect non-https requests to your https server.

Code:
SSLOptions +StrictRequire
SSLRequireSSL
SSLRequire %{HTTP_HOST} eq "your-site.com"
ErrorDocument 403 https://your-site.com


Another idea is to rewrite non-https to https even without mod_ssl being loaded.

Code:
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]


Blackhorse mentioned using the server port 443, but you can also redirect everything served on port 80 to https.

Code:
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

Code:
RewriteCond %{SERVER_PORT} ^80$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]


For more ideas, see HTTPS / SSL Apache Tips, .htaccess Tricks, and Server Hacks
 
Status
Not open for further replies.