Softaculous


Topic : Force Apache to pick index.php over index.html


Posted By: phpenthu on November 16, 2016, 11:54 pm
[Background] >> I am using Ampps stack for PHP development. In my public folder there are two index files. One is index.html and other is index.php. After running Apache server, when I type in URL - [localhost/<my-web-project>/public/][1], I get the content of [**index.html**], where as I want Apache to pick [index.php] located in the same folder. I don't want to specify everytime [localhost/<my-web-project>/public/index.php][4].

[Problem] >> So basically, how do I configure Apache to give preference/precedence to index.php instead of index.html. I know a similar @stackoverflow post - stackoverflow-DOT-COM/questions/16191861/giving-index-html-priority-over-index-php but the solution does not apply to me and I do not have enough reputation to comment there. So I am creating a new question.

[My .htaccess file, if that helps]>>

PHP Code

 <IfModule mod_rewrite.c>
        <
IfModule mod_negotiation.c>
            
Options -MultiViews
        
</IfModule>
    
        
RewriteEngine On
        
        
# Redirect Trailing Slashes If Not A Folder...
        
RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule 
^(.*)/$ /$[L,R=301]
        
        
# Handle Front Controller...
        
RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond 
%{REQUEST_FILENAME} !-f
        RewriteRule 
index.php [L]
        
        
# Handle Authorization Header
        
RewriteCond %{HTTP:Authorization} .
        
        
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    </
IfModule





Posted By: jumla40_guy on December 1, 2016, 3:21 pm | Post: 1
Have you tried:

DirectoryIndex index.php index.html // default is index.php

in your htaccess to force Apache to use a different default order -> yours

Powered By AEF 1.0.8 © 2007-2008 Electron Inc.