Sign up with your email address to be the first to know about new products, VIP offers, blog features & more.


How to remove “public/index.php” from URL generated in Laravel

Option 1: Use .htaccess

If it isn’t already there, create an .htaccess file in the Laravel root directory. Create a .htaccess file your Laravel root directory if it does not exists already. (Normally it is under your public_html folder)

Edit the .htaccess file so that it contains the following code:

Now you should be able to access the website without the “/public/index.php/” part.

Option 2 : Move things in the ‘/public’ directory to the root directory

Make a new folder in your root directory and move all the files and folder except public folder. You can call it anything you want. I’ll use “laravel_code”.

Next, move everything out of the public directory and into the root folder. It should result in something somewhat similar to this: remove public/index.php URL generated Laravel

After that, all we have to do is edit the locations in the laravel_code/bootstrap/paths.php file and the index.php file.

In laravel_code/bootstrap/paths.php find the following line of code:

And change them to:

In index.php, find these lines:

And change them to:

Ref: How to remove “public/index.php” from URL generated in Laravel

Thank you for your love.
4 Responses
  • network
    June 26, 2017

    Pretty nice post. I just stumbled upon your weblog
    and wished to mention that I have really loved surfing around
    your weblog posts. After all I’ll be subscribing on your feed and I am hoping
    you write once more soon!

  • Friv 2018
    September 4, 2017

    Wonderful, what a web site it is! This webpage gives useful information to us, keep it up.

What do you think?

Your email address will not be published. Required fields are marked *

%d bloggers like this: