Jump to content

If Install.php Exists, redirect to install.php


private_guy

Recommended Posts

Hi there,

 

My script has an install.php file which if it exists, I want it to redirect to the install.php file. I entered this code in index.php:

//----------------------------
// Checking If Install File Exists!
//----------------------------
if(is_dir('./install.php') and $_SERVER['HTTP_HOST'] != 'localhost')
{
header("Location: ./install.php");
die();
}
//----------------------------
// Finished Checking
//----------------------------

But it didn't work, it just views index.php naturally, even if install.php exists, what I'm I doing wrong?

 

Many thanks for your help.

 

Best Regards,

Private_Guy

Well I just use this, wouldn't this work?

//----------------------------
// Checking If Install File Exists!
//----------------------------
if(file_exists('./install.php') and $_SERVER['HTTP_HOST'] != 'localhost')
{
header("Location: ./install.php");
die();
}
//----------------------------
// Finished Checking
//----------------------------

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.