How to Remove Public From URL in Laravel

In this tutorial you will learn about the How to Remove Public From URL in Laravel and its application with practical example.

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

Remove Public From URL Laravel

In this step by step tutorial I’ll show you how to remove public from URL in your laravel application. In this article I’ll show you two different method to remove public from URL in laravel

  • Remove public from url using .htaccess
  • Raname server.php and move .htaccess file

Remove public from url using .htaccess

In this method we will rewrite url using .htaccess file of your laravel project. The .htaccess file  can be found in root directory of your laravel application. Before you update your .htacces file you must have mod_rewrite enabled on your Apache server. The rewrite module is required to apply these settings.

Let’s open .htaccess file and put the following code in it.

Rename server.php and move .htaccess file

In this method you need to follow the below steps to remove public from url in laravel

Step 1:-

Rename server.php to index.php. The server.php file is located at your project’s root directory.

Step 2:-

Copy the .htaccess file from /public directory to your Laravel project’s root directory.

In this tutorial we have learn about the How to Remove Public From URL in Laravel and its application with practical example. I hope you will like this tutorial.