Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
web.config direct to https
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Zaka" data-source="post: 401569" data-attributes="member: 12728"><p>You can't use web.config to go to HTTPS and PHP wont know that you are on HTTPS or not because of the fact that the certificate is not on the server or so. I did get around this by writing some PHP code tho.</p><p>[PHP]public function thisFullURL($enableSSL = NULL) {</p><p> $serverName = $_SERVER['SERVER_NAME'];</p><p> $uri = $_SERVER['REQUEST_URI']; </p><p> </p><p> if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {</p><p> $protocol = 'https://';</p><p> }</p><p> else {</p><p> $protocol = 'http://';</p><p> }</p><p> </p><p> $fullURL = $protocol.$serverName.$uri;</p><p> $URL = $serverName.$uri;</p><p> </p><p> if ( $enableSSL && $protocol == 'http://' )</p><p> header("location: https://{$URL}");</p><p> else if( !$enableSSL && $protocol == 'https://' )</p><p> header("location: http://{$URL}");</p><p> else</p><p> return $fullURL;</p><p> }[/PHP]</p><p></p><p>Then you just have to pass <strong>true or false</strong> into the function true = SSL Redirection Enabled, false = SSL Redirection Disabled</p></blockquote><p></p>
[QUOTE="Zaka, post: 401569, member: 12728"] You can't use web.config to go to HTTPS and PHP wont know that you are on HTTPS or not because of the fact that the certificate is not on the server or so. I did get around this by writing some PHP code tho. [PHP]public function thisFullURL($enableSSL = NULL) { $serverName = $_SERVER['SERVER_NAME']; $uri = $_SERVER['REQUEST_URI']; if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') { $protocol = 'https://'; } else { $protocol = 'http://'; } $fullURL = $protocol.$serverName.$uri; $URL = $serverName.$uri; if ( $enableSSL && $protocol == 'http://' ) header("location: https://{$URL}"); else if( !$enableSSL && $protocol == 'https://' ) header("location: http://{$URL}"); else return $fullURL; }[/PHP] Then you just have to pass [B]true or false[/B] into the function true = SSL Redirection Enabled, false = SSL Redirection Disabled [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
web.config direct to https
Top