Skip to content
Advertisement

How to rewrite or remove public from laravel 5 urls in proper way?

I’m trying to remove the public/index from laravel url, since this is one of the common question so there are lot of tutorials and answer. I also searched about this and followed the @rimon.ekjon answer which is working fine for me it’s pretty simple.

Rename the server.php in the your Laravel root folder to index.php and copy the .htaccess file from /public directory to your Laravel root folder. — Thats it !! 🙂

I’m confuse why i should rename or move something from one place to another because there will be a reason why files exist in public folder. I want to show another good answer which is also following the almost same pattern.

I’m thinking that by following above answers’ step may be create some issues in future if there will be a new requirement or new feature request in the project.

So can anyone guide me is there any best to rewrite or remove the public/index from laravel 5. I would like to appreciate if someone guide me.

Advertisement

Answer

You should configure your web server’s document / web root to be the public directory. That way you don’t have to copy/move/delete anything.

For apache you can look here.

For nginx you can read here.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement