0

I was trying to achieve that, If someone opens the URL /login then It should open the /login/index.php file. and it requires that multiviews needs to be enabled, I found the below options

1.Adding in the .htacces

<IfModule mod_negotiation.c>
    Options MultiViews
</IfModule>
  1. Add the multiview option to your apache conf file, like below

     <Directory /var/www/sites/foo/>
     Options +FollowSymLinks +MultiViews +Indexes
     DirectoryIndex index.php
     AddType application/x-httpd-php .php
    

but these solutions didn't work.

Mahak Choudhary
  • 1,286
  • 1
  • 16
  • 13
  • "/login then It should open the /login/index.php" - this has nothing to do with MultiViews (which is part of mod_negotiation, as your first example suggests). To achieve this you would need to set `DirectoryIndex index.php` (part of mod_dir - a _base_ module), as in your second example. (Your first example explicitly disabled MultiViews anyway.) What was actually happening when `/login` was requested? Did you restart Apache after making changes to the server config? Did you edit the correct place in the server config? – MrWhite Sep 11 '22 at 18:03
  • @MrWhite Thanks for the comments. - I edited the question and removed the - before Multiviews, It was mistakenly added. - I restarted the server many times and edited the correct files - but when I made the changes in the mime.conf, I got the desired results – Mahak Choudhary Sep 12 '22 at 10:54

1 Answers1

1

Finally, I found the below solution that worked for me, hope It will help someone else too.

Here is the solution :

open the below file

sudo nano /etc/apache2/mods-enabled/mime.conf

Find the below line in the file

AddType application/x-httpd-php .php .phtml .html .htm

Uncomment(If commented) and add .php If It does not contain it. Restart the server

sudo service apache2 restart
Mahak Choudhary
  • 1,286
  • 1
  • 16
  • 13
  • 1
    This would imply that Apache was not configured to parse `.php` files? However, doing this is no different than the second example in your question, which would perhaps imply you were either editing the wrong file or did not restart Apache? – MrWhite Sep 11 '22 at 18:04