Create or edit the .htaccess file in the Laravel root directory and configure the RewriteRule to remove “public/index.php” from the URL.
Advertisement
You must have mod_rewrite enable on your Apache server. The rewrite module is required to apply these settings. You also have enabled .htaccess in Apache virtual host for Laravel.
Edit the .htaccess file so that it contains the following code:
1 2 3 4 | <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*)$ public/$1 [L] </IfModule> |
Now you should be able to access the website without the “/public/index.php/” part.
2 Comments
Rahul, this probably works for the ‘/’ route. I’m in trouble with the ‘/mypage’ route. To let it work I have to use ‘/index.php/mypage’ witch is not so nice. Can you teel me how to get rid of index.php for this kind of route?
not work in local server like xampp