4

I can't seem to understand why my Homepage has suddenly refused to load directly i.e: www.mysite.com/ but loads only if you type www.mysite.com/index.php

This is the Site:

COMPARE:

http://www.propasiarealty.com // Sends you to the 404 page

WHEREAS:

http://www.propasiarealty.com/index.php // Loads the homepage.

Can't figure out exactly what is wrong, please help.

Bellow is a Filezilla screenshot:

enter image description here

EDIT 01

Please see my HTACCESS... Snapshot enter image description here


UPDATE 02 I have modified the HTACCESS still no success, now looks like:

DirectoryIndex index.php

#ErrorDocument 400     /400.html

#ErrorDocument 401     /401.html 

ErrorDocument 403     /errs/404.php

ErrorDocument 404     /errs/404.php

#ErrorDocument 500     /500.html

Options -Indexes

But still not Working


UPDATE 03 [This worked]

The Solution as suggested by @HPierce was to modify the HTACCESS to look something like bellow:

DirectoryIndex index.php


RewriteEngine on  

RewriteRule ^$ index.php

    #ErrorDocument 400     /400.html

    #ErrorDocument 401     /401.html 

    ErrorDocument 403     /errs/404.php

    ErrorDocument 404     /errs/404.php

    #ErrorDocument 500     /500.html

    Options -Indexes
Kara
  • 6,115
  • 16
  • 50
  • 57
Universal Grasp
  • 1,835
  • 3
  • 20
  • 29

1 Answers1

4

Add a new declaration for DirectoryIndex in your .htaccess file.

DirectoryIndex index.php

With Apache, the default DirectoryIndex will be set to index.html which is different than your index.php page that you want to serve.

Alternatively you might want to specify both files as your DirectoryIndex

DirectoryIndex index.html index.php

This would check for index.html first then index.php if index.html is not available. This might be the better solution, as changing the defaults may confuse anyone else that has to work on your website.

Apache docs on mod_dir: http://httpd.apache.org/docs/2.4/mod/mod_dir.html

If that doesn't work, you might consider adding a rewrite rule - though it's not recommended. Rewrite rules interrupt the incoming HTTP request and reforms it to match the way your server is set up.

RewriteEngine on 
RewriteRule ^$ index.php

This rewrite rule matches only requests to http://www.propasiarealty.com and will not match http://www.propasiarealty.com/

Using rewrite rules requires mod_rewrite to be installed - more info here http://httpd.apache.org/docs/current/mod/mod_rewrite.html

HPierce
  • 7,249
  • 7
  • 33
  • 49
  • Do you have access to httpd.conf, Apache's global config file? If so, post some of the contents of that - special emphasis on any lines that have `AllowOverrides` on it. – HPierce Jul 27 '15 at 17:27
  • Wherez the `httpd.conf` located at? – Universal Grasp Jul 27 '15 at 17:34
  • `$ apachectl -V` should tell you (it varies from environment to environment). http://stackoverflow.com/questions/12202021/where-is-my-httpd-conf-file-located-apache – HPierce Jul 27 '15 at 17:42
  • Ooops, I dont think I can get to that File... This is the First time am Facing this issue, and kinda tried almost everything I know so far... What else could possibly cause such a misbehavior?..Again thanks for suggestions!! – Universal Grasp Jul 27 '15 at 17:45
  • I'm hesitant to suggest this, because it is such a horrible dirty hack that shouldn't be needed here. But try adding this to your `.htaccess` file: `RewriteEngine on RewriteRule ^$ index.php` Where `RewriteEngine` and `RewriteRule` are on different lines. You can test it here and prove that it would work with an appropriately configured server: http://htaccess.madewithlove.be/ – HPierce Jul 27 '15 at 18:00
  • Wow!!!.... That super worked. You can add that: `RewriteEngine on RewriteRule ^$ index.php` in your answer and am gonna accept it as the Solution to my type of problem... Ty!! – Universal Grasp Jul 27 '15 at 23:16