Home  |  About  | Last |  Submit  |  Contact
AllQuests.com




Previous Question:  ingreasing height with text  CSSNext Question:  set off alarm at specific time  PHP
Question Redirect Errors ( SitePoint Forums PHP )
Updated: 2010-07-21 05:50:03 (2)
Redirect Errors

So I am including the following code ontop of every page. I want it to redirect to http:// when it detects a https:// IF it isn't in the array.

PHP Code:


$secureArray
= array('signup.php','signin.php');

if (!
in_array($secureArray,$_SERVER['REQUEST_URI'])) {
   if (
$_SERVER['SERVER_PORT'] == 443) {
      
header("Location: http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
   }
}
When I visit a page that isn't in the secureArray, it redirects fine -- but when i go to signup.php or signin.php, it can't resolve the page...

Thanks,
Mike

Answers: Redirect Errors ( SitePoint Forums PHP )
Redirect Errors

Why don't you just put that into a file and require() that file?

As well as this, put an exit; command after the header - otherwise the rest of the page will still execute, the browser just won't see it.

Jake Arkinstall

Redirect Errors

It is in a file -- I'll test out the exit;

MadMike

Previous Question:  ingreasing height with text  SitePoint Forums  CSSNext Question:  set off alarm at specific time  SitePoint Forums  PHP

- Source: Redirect Errors SitePoint Forums PHP
- Previous Question: ingreasing height with text SitePoint Forums CSS
- Next Question: set off alarm at specific time SitePoint Forums PHP