Laravel 6 Remove public from URL

Today, We want to share with you Laravel 6 Remove public from URL.In this post we will show you laravel 6.2 delete public from url, hear for laravel 5.7 delete public from url we will give you demo and example for implement.In this post, we will learn about delete public/index.php from laravel url with an example.

Laravel 6 Remove public from URL

There are the Following The simple About how to delete public from url in laravel on server Full Information With Example and source code.

As I will cover this Post with live Working example to develop delete public from laravel 6.2 using htaccess, so the how to delete public from url in laravel 6.0 using htaccess is used for this example is following below.

Read Also:  Laravel 5/6/7 Angular JS CRUD Example With File Upload

Example 1: Delete Public From url via Laravel 5.8 or 6.0

Step 1:- here simple phase, now we go to the public folder of our web application. In it we shall find a file of .htaccess name. We have to delete the file from there as well as take it out of the public folder.

Step 2:- Outside we shall find a file of a server.php name. We have to change the name of that file. The name of that file is to delete server.php as well as keep index.php.

require __DIR__.'/../bootstrap/autoload.php';
to

 require __DIR__.'/bootstrap/autoload.php';
And

$app = require_once __DIR__.'/../bootstrap/app.php';
to

$app = require_once __DIR__.'/bootstrap/app.php';

Step 3:- Now if we delete public from our url as well as execute the web application of laravel after that our web application shall be open without public.

Read Also:  Laravel 5/6/7 Import & Export data to Excel CSV using maatwebsite

and then last you can simple Flush all cache and delete cookie.

Example 2: Create .htaccess file and update content

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

Rename server.php and move .htaccess file

  • name update server.php in main Laravel root folder to index.php
  • ctrl + c and then .htaccess file from /public directory to main Laravel root folder
Web Programming Tutorials Example with Demo

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Delete Public From url via Laravel 5.8 or 6.0.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.