Without index.php laravel url not working In Ubuntu/How to remove index.php in laravel ubuntu

By | March 23, 2018

How to remove index.php in the url of laravel in ubuntu

Solutiion:After a fresh installation of laravel 5.6 with php7 in ubuntu 16 version.if we execute the below url

http://localhost/myproject/public — this will show the welcome page

http://localhost/myproject/public/adminlogin — this will not work .But if you add index.php in the url like below

http://localhost/myproject/public/index.php/adminlogin– this will work

Actually we want to remove the index.php in the url

For this follow the below solution that will fix the issue

Open the apache2.conf file using the below command (cant open this file directly because permission denied for the user)

sudo -H gedit /etc/apache2/apche2.conf

Add the below changes


Options Indexes FollowSymLinks
AllowOverride All
Require all granted

change the AllowOverride None to ‘AllowOverride All’.

After saving the above file execute the below commands,for enable moderewrite and apache restart

sudo a2enmod rewrite
sudo apache2 restart