Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

$_SERVER['SERVER_PORT'] - is SSL always 443? 1

Status
Not open for further replies.

LTeeple

Programmer
Aug 21, 2002
362
CA
Hi all,
Regarding the variable $_SERVER['SERVER_PORT'] - when using SSL is the value always 443?

I want to force a redirect to ssl for specific pages, and thought this would be a way to do it:
Code:
if ($_SERVER['SERVER_PORT'] != 443)
  //redirect to [URL unfurl="true"]https://page[/URL]

Is there a better way?

Thanks!

[cheers]
Cheers!
Laura
 
The value in $_SERVER['SERVER_PORT'] will be the port number to which the client connected. The standard port for HTTPS is 443, but this does not necessarily have to be the case.

For example, the URL:

[ignore][/ignore]

would direct an HTTPS connection to port 8000 if the web server had its HTTPS subsystem listening on that port, the browser would get a connection.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Thanks, sleipnir214 for your response.

I always appreciate the time you take to participate in these forums!

[cheers]
Cheers!
Laura
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top