Page 1 of 1

Echo the difference between '/' and '/index.php'

Posted: Tue Jul 31, 2007 10:10 am
by elHelgo
For some reason, my site lags when it runs "www.website.com", but loads just fine when it runs "www.website.com/index.php"

Is there a way that I can tell if the URL has the "index.php" in it or not?

I've tried to use the predefined variables REQUEST_URI, SCRIPT_NAME, SCRIPT_FILENAME, and PHP_SELF when I'm on "www.website.com/", but all of these return an index.php in the variable.

The goal that I'm trying to achieve is that if PHP can recognize "www.website.com/", I want to use headers to make it go to "www.website.com/index.php"

Any help on this would be greatly appreciated.

Thanks.

Posted: Tue Jul 31, 2007 10:12 am
by Begby
You should try to find out why it is lagging and fix that problem instead.

Posted: Tue Jul 31, 2007 10:41 am
by pickle
The webserver sounds like it's been set up to make "index.php" a default index page. Webservers can't display "/" - they need a file to show. So, in this instance, the server is showing "index.php".

I'm with ~Begby - try and figure out why "/" is slow but "/index.php" is not slow. If it's a consistent problem, I'd check the configuration of the server software (I'm guessing Apache?)

Posted: Tue Jul 31, 2007 11:00 am
by elHelgo
I know that there is something wrong with the host and/or server, but I was trying to find a quick fix for the problem. I did find one through trial and error, and was wrong about the REQUEST_URI output.

Simply enough, I just did this:

Code: Select all

if ($_SERVER['REQUEST_URI']=="/"){
  header("Location: newsite.com");
}
Hopefully this will buy me enough time to debug my other problems in life.