Logo Questions Linux Laravel Mysql Ubuntu Git Menu

Laravel 4 remove Index.php from URL

I need some help with laravel 4 application i need to remove Index.php from url i have tried the solution that has been mentioned in laravel documentation

Pretty URLs

The framework ships with a public/.htaccess file that is used to allow URLs without index.php. If you use Apache to serve your Laravel application, be sure to enable the mod_rewrite module.

If the .htaccess file that ships with Laravel does not work with your Apache installation, try this one:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

any Suggestions :) ?

like image 808
Ahmad abdallah Avatar asked Mar 20 '23 06:03

Ahmad abdallah

1 Answers


Try the following steps,

  1. Activate the mod_rewrite module with,

sudo a2enmod rewrite

  1. and restart the apache

sudo service apache2 restart

  1. To use mod_rewrite from within .htaccess files (which is a very common use case), edit the default VirtualHost with

sudo nano /etc/apache2/sites-available/000-default.conf

  1. Search for “DocumentRoot /var/www/html” and add the following lines directly below:

    <Directory "/var/www/html">` 
            AllowOverride All
  2. Save and exit the nano editor via CTRL-X, “y” and ENTER.

  3. Restart the server again:

sudo service apache2 restart

like image 51
Vinod VT Avatar answered Apr 02 '23 00:04

Vinod VT