How to set defaut file index.php in my VPS

smbongtoi85

Verified User
Joined
Dec 9, 2019
Messages
9
Hello all!, sorry about my english.

I have a question about DirectoryIndex in Apache

I created 2 users have 2 source PHP:
- User 1: Pure PHP ( have include .htaccess but HAVEN'T add line "DirectoryIndex index.php index.html index.htm" ) with PHP 5.3 suphp
- User 2: Laravel framework ( have include .htaccess but HAVE add line "DirectoryIndex index.php index.html index.htm" ) with PHP 7.4 suphp

Both are run by default index.php file when access domain of each user. That is a normal. But if I remove remove line "DirectoryIndex index.php index.html index.htm" in "User 2" then I can't access to index.php if just enter domain.

Please expand it help me, and help me to config to can default index.php when access domain, I want them in sync. Thanks for reading and for help.
 
/etc/httpd/conf/extra/httpd-directoryindex.conf
or for old installs:
/etc/httpd/conf/httpd.conf
you can see:
<IfModule dir_module>
DirectoryIndex index.html index.htm index.shtml index.php index.php5 index.php4 index.php3 index.phtml index.cgi index.pl
</IfModule>
 
It (/etc/httpd/conf/extra/httpd-directoryindex.conf) is: "DirectoryIndex index.html index.htm index.shtml index.php index.phtml", But Why User1 run index.php ? If is true, it will be is "index.html", in user1, I have index.html, thanks for reply
 
Thank you so much, I checked the vitualhort file, and I found it was repeating the code of virtuahost (why is it?), I removed that line of repeating code and I discovered User 1, using PHP5. 3 has the following code:
<FilesMatch "\.php$">
AddHandler x-httpd-php53 .php
</FilesMatch>
, and User 2 using PHP7.4 does not have that code, so How to add code ? for User 2 ( PHP 7.4 ) to default index.php to be displayed without having to add manual to htaccess.
 
I found "AddHandler x-httpd-php74 .php" in google.
I add that code, i still dont work.
Help me!
 
Last edited:
Back
Top