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 force https with url helper

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.

Read Also:  country state city drop down list in php mysql

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
Read Also:  Laravel 5/6/7 Import & Export data to Excel CSV using maatwebsite
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. Read Also:  Remove “public/index.php” from URL in Laravel
  2. Read Also:  Check if row exists using Laravel
  3. Read Also:  Basic calculator program using javascript using functions
  4. Read Also:  how to show error messages below the textbox in javascript validation?
  5. Read Also:  Laravel Check Array Empty in Blade Example
  6. Read Also:  How to set limit and offset in Laravel Eloquent?
  7. Read Also:  php - SMTP Send mail using PHPMailer PHP Contact Form
  8. Read Also:  WooCommerce Get Linked Products
  9. Read Also:  Laravel 6 right join query Example Tutorial
  10. Read Also:  Laravel 6 left join query Example Tutorial
CLOSEX