简体   繁体   中英

How to enable MultiViews in Apache

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM