1

I did try lots of solution from different resources like GitHub, StackOverflow, etc, but didn't get the solution to remove index.php from url in laravel 5.8 version. This issue occurs only in version 5.8

Here is my .htacess file code. Which is placed on root directory:

DirectoryIndex index.php
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On
    RewriteBase /laravel/portal/

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?/$1 [QSA,L]

</IfModule> 

If somebody has a solution. Please let me know

PHP Ninja
  • 1,055
  • 2
  • 9
  • 28

2 Answers2

1

You must have mod_rewrite enable on your Apache server. The rewrite module is required to apply these settings. You also have enabled .htaccess.

<IfModule mod_rewrite.c>
  RewriteEngine On 
   RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
Rakesh Jakhar
  • 6,380
  • 2
  • 11
  • 20
0

I Got the solution. Thanks for your help.

In order to use mod_rewrite you can type the following command in the terminal:

sudo a2enmod rewrite

Restart apache2 after

sudo systemctl restart apache2

Here is root directory .htaccess file:

<IfModule mod_rewrite.c>
  Options +FollowSymLinks -Indexes
RewriteEngine On

RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
PHP Ninja
  • 1,055
  • 2
  • 9
  • 28