Author Topic: Custom 404 page  (Read 2107 times)

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14310
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
Custom 404 page
« on: August 21, 2008, 02:20:11 PM »
I use the following code in a custom 404 page:
Code: [Select]
<?php
if(strpos($_SERVER['SCRIPT_NAME'], 'modeler') >= || strpos($_SERVER['SCRIPT_NAME'], 'modeller') >= 0)
header("Location: http://www.americanbeautytools.com/site/index.php?req=learn&sub=hobby&app=1");
elseif(
strpos($_SERVER['SCRIPT_NAME'], 'inhouse') >= || strpos($_SERVER['SCRIPT_NAME'], 'in-house') >= || strpos($_SERVER['SCRIPT_NAME'], 'freeinhouse') >= || strpos($_SERVER['SCRIPT_NAME'], 'fite') >= 0)
header("Location: http://www.americanbeautytools.com/site/index.php?req=support&sub=test");
else
header("Location: http://www.americanbeautytools.com/site");
?>

Originally it was just the if and the else.  I am trying to add the elseif and it goes to the first redirect if I use any of the elseif options.

Why would it be doing that?

micah

  • A real person, on the Internet.
  • Ass Wipe
  • Posts: 6915
  • Karma: +58/-55
  • Truth cannot contradict truth.
    • micahj.com
Re: Custom 404 page
« Reply #1 on: August 21, 2008, 03:21:18 PM »
have you narrowed the problem down to determin that its the elseif causing the problem?

what if you change that line to:

elseif(1==1)

will it go to the correct page then?
"I possess a device, in my pocket, that is capable of accessing the entirety of information known to man.  I use it to look at pictures of cats and get in arguments with strangers."

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14310
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
Re: Custom 404 page
« Reply #2 on: August 21, 2008, 09:25:36 PM »
Code: [Select]
<?php
if(strpos($_SERVER['REQUEST_URI'], 'modeler') !== false || strpos($_SERVER['REQUEST_URI'], 'modeller') !== false)
header("Location: http://www.americanbeautytools.com/site/index.php?req=learn&sub=hobby&app=1");
elseif(
strpos($_SERVER['REQUEST_URI'], 'inhouse') !== false || strpos($_SERVER['REQUEST_URI'], 'in-house') !== false || strpos($_SERVER['REQUEST_URI'], 'freeinhouse') !== false || strpos($_SERVER['REQUEST_URI'], 'fite') !== false)
header("Location: http://www.americanbeautytools.com/site/index.php?req=support&sub=test");
else
header("Location: http://www.americanbeautytools.com/site");
?>

I swapped out SCRIPT_NAME for REQUEST_URI and looked for false instead of a position.  Works great now.