Does Having Index.php Cause Redirecting?

Does Having Index.php Cause Redirecting? thumbnail
Website addresses can use defaults for home page file names.

All Web servers enable a website, or any directory within that site, to have a default page. This means that the user does not have to type in a file name to get to the home page for that site or directory of the site. The default file name for that page is index.html, but it can also be index.php. Delivering a default page is not a redirection.

  1. Website Directories

    • Every website has a standard default file name for all directories. The root directory is treated like any other directory, except that the address to the root directory does not have a name. The root directory of the website “www.asite.com” is reached by “www.asite.com” not “www.asite.com/root.” With any other directory, the name of the directory and path to that directory has to be part of the address, but the default file does not have to be named. So if the site "asite" has a “products” directory and beneath that a “new” directory, the default file in that directory can be invoked by the address “www.asite/products/new.”

    Default Files

    • If an address does not contain a file name, a Web server will look for a file called index.html first. If that is not present it will look for any other file called index, with any other file extension, including index.php. Following this, it will look for a file called default.html and then any file called default with any other file extension, including default.php. A default is not a redirection.

    Redirection

    • A redirect occurs when a Web browser requests a page that was once in a file on that website but is no longer there. The file may exist still, but either with a different name, or in a different location on that site, or even on a different website. The website administrator can prevent requests for that page being replied to with an error message that the page does not exist by informing the Web server of the page's new address. Given the new address, the Web server responds to any request for the page with a redirect status code and the new address. The system of default pages does not follow this pattern and so defaulting to index.php is not a redirection.

    Configuration

    • Most Web servers use the Apache server system. The next most common Web server system is IIS by Microsoft. Both of these systems enable the website administrator to alter the series of default file names used in the directories of a website. In Apache systems, a file called “.htaccess” located in the root directory contains the configuration for the site. The line “DirectoryIndex index.php” will instruct the server to look for index.php first, even if there is also an index.html in the same directory. A series of backup defaults can be entered in order by listing them after index.php in the DirectoryIndex command, each default separated by a space. ISS provides a graphical interface to set up the default file name order, which is available in the “Documents” tab of the “Default Web Site Properties” option.

Related Searches:

References

  • Photo Credit Comstock/Comstock/Getty Images

Comments

Related Ads

Featured