GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   SSL and Redirect (https://gfy.com/showthread.php?t=804463)

Barefootsies 02-01-2008 03:43 PM

SSL and Redirect
 
I've got an ssl cert installed for my domain example.com and I want all non-https requests to automatically go to the https. I've got it sorta working .. it redirects but gives me this error page:


Bad Request
Your browser sent a request that this server could not understand.

Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.

Hint: https://example.com/

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


Is there a right way to handle this?

Barefootsies 02-01-2008 04:58 PM

bump for the answer

baddog 02-01-2008 05:00 PM

How are you currently redirecting?

baddog 02-01-2008 05:02 PM

Easiest way is to use mod_rewrite and place a .htaccess file in your public_html directory with the following

Code:

rewriteEngine On
rewriteCond %{SERVER_PORT}!443
rewriteRule ^(.*)$ https://www.example.com/$1 [R,L]


at least, that is what my research shows

riscphree 02-01-2008 05:10 PM

lulz word for word from my post on his forum
wiredwebonline.com/showthread.php?p=95#post95

Quote:

I've got an ssl cert installed for my domain example.com and I want all non-https requests to automatically go to the https. I've got it sorta working .. it redirects but gives me this error page:


Bad Request
Your browser sent a request that this server could not understand.

Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.

Hint: example.com

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Is there a right way to handle this?

netpimp 02-01-2008 05:42 PM

An alternate method, though it won't carry your host arguments is just to drop it in a vhost. (mod_ssl config example), but you can at least use that to intercept 404 and such as well and send them back to the front. If your coding uses all relative files and/or any links are all https: you'll be fine.

Code:

<VirtualHost x.x.x.x:80>
SSLEngine off
Port 80
ServerName some.server.name
Redirect / https://some.other.host
</VirtualHost>


Barefootsies 02-01-2008 05:48 PM

Quote:

Originally Posted by riscphree (Post 13729332)
lulz word for word from my post on his forum
wiredwebonline.com/showthread.php?p=95#post95

Correct friend.

Was trying to get an answer for ya. I knew Baddog, among others, would know the answer to this fairly simply. Better to get the right answer, then give a theory.


All times are GMT -7. The time now is 10:39 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123