How to Remove Public From URL in Laravel

This is image title
Originally Published at Tutsmake.com

Remove the public from URL in laravel. In this tutorial, we will learn how to remove the public from URL in laravel.

Remove Public From URL Laravel

There is two way to remove public from URL in laravel
*

  • Create .htaccess file and update content
  • Raname server.php and move .htaccess file

Create .htaccess file and update content

Now Create and update the .htaccess file in the Laravel. You can find .htaccess file in root directory.

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.

Update the code into your .htaccess file:

   RewriteEngine On 
   RewriteRule ^(.*)$ public/$1 [L]
</IfModule>```


### Rename server.php and move .htaccess file

Here, you can follow the below steps for remove public from url in laravel

The first step is, Rename server.php in your Laravel root folder to index.php
Copy the .htaccess file from /public directory to your Laravel root folder.


### Conclusion

In this tutorial remove the public from URL in laravel. Here you have learned two ways to remove the public from URL in laravel.

Originally Published at [Tutsmake.com](https://www.tutsmake.com/how-to-remove-public-from-url-in-laravel/ "Tutsmake.com")
1 Likes165.60 GEEK