Answers for "how to remove index.php from yii2 and apache2"

PHP
1

how to remove index.php from yii2 and apache2

#paste this in your terminal
sudo a2enmod rewrite
sudo service apache2 restart


#add the line below to /etc/apache2/sites-enabled/000-default.conf

<Directory /var/www/html>
   AllowOverride All
</Directory>

#create file .htaccess within web dir, paste the lines below into the file

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
</IfModule>
Posted by: Guest on September-23-2021

Code answers related to "how to remove index.php from yii2 and apache2"

Browse Popular Code Answers by Language