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

Link to comment
Share on other sites

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
//----------------------------

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.