how to remove index php from yii2 and apache2

Solutions on MaxInterview for how to remove index php from yii2 and apache2 by the best coders in the world

showing results for - "how to remove index php from yii2 and apache2"
Carlos
10 Jun 2020
1#paste this in your terminal
2sudo a2enmod rewrite
3sudo service apache2 restart
4
5
6#add the line below to /etc/apache2/sites-enabled/000-default.conf
7
8<Directory /var/www/html>
9   AllowOverride All
10</Directory>
11
12#create file .htaccess within web dir, paste the lines below into the file
13
14<IfModule mod_rewrite.c>
15  RewriteEngine On
16  RewriteBase /
17  RewriteRule ^index\.php$ - [L]
18  RewriteCond %{REQUEST_FILENAME} !-f
19  RewriteCond %{REQUEST_FILENAME} !-d
20  RewriteRule . /index.php [L]
21</IfModule> 
22