Search code examples
phpapachecentosapache-config

index.php not loading by default


I have just installed CentOS, Apache and PHP. When I visit my site http://example.com/myapp/, it says "forbidden". By default it's not loading the index.php file.

When I visit http://example.com/myapp/index.php, it works fine.

Any idea how to fix that issue?


Solution

  • Apache needs to be configured to recognize index.php as an index file.

    The simplest way to accomplish this..

    1. Create a .htaccess file in your web root.

    2. Add the line...

    DirectoryIndex index.php

    Here is a resource regarding the matter...
    http://www.twsc.biz/twsc_hosting_htaccess.php

    Edit: I'm assuming apache is configured to allow .htaccess files. If it isn't, you'll have to modify the setting in apache's configuration file (httpd.conf)