Laravel 6 Remove public from URL

Laravel php Programming Technology

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.

List of all Google Adsense, VueJS, AngularJS, PHP, Laravel Examples.

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.

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.

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.


Related FAQ

Here are some more FAQ related to this Article:

  1.   Laravel 5 – Remove Public from URL
  2.   Laravel Remove Public From URL Steps
  3.   Laravel 6 change date format example Tutorial
  4.   Global Config variable In Laravel 6 Example
  5.   Laravel User Role based Access control Authentication
  6.   Remove “public/index.php” from URL in Laravel
  7.   Laravel 6 tree view Plugins using jQuery Example
  8.   Laravel 6 right join query Example Tutorial
  9.   get product with Rakuten Marketing API using PHP
  10.   Bootstrap On-Off Toggle Switch jQuery Plugins

Leave a Reply

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