Laravel Remove Public From URL Steps

Today, We want to share with you Laravel Remove Public From URL Steps.In this post we will show you Remove “public” in URL in Laravel 5.7 Step By Step, hear for Laravel 5.7 – Remove Public from URL using htaccess we will give you demo and example for implement.In this post, we will learn about How to Remove Public Directory in Laravel 5.5, 5.6, 5.7 with an example.

Laravel Remove Public From URL Steps

There are the Following The simple About Laravel Remove Public From URL Steps Full Information With Example and source code.

As I will cover this Post with live Working example to develop how to remove public from url in laravel on server,, so the some laravel 5.7 remove public from url for this example is following below.

Also Read :  PHP Download Images From URL Using cURL Example

Step 1: Rename File

Laravel’s .htaccess to remove “public” from URL

simple change your server.php file in the root file to index.php

//Rename 
server.php 
//in your Laravel root folder to 
index.php

Step 2: Update .htaccess

Simple Your .htaccess file and put it laravel Main root folder

Options -MultiViews -Indexes

RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]


# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

 
# Handle Front Laravel Controller...
RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]


RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(css|js|images)/(.*)$ public/$1/$2 [L,NC]

Laravel 5.* Project- Remove public from URL

Move Laravel Project From localhost to live production server : More Easy MethodsRemoving PUBLIC from URL in Laravel

Also Read :  Set Cookies Get Cookies Delete Cookies with PHP

Change:
require __DIR__.'/../bootstrap/autoload.php';
to:
require __DIR__.'/../laravel/bootstrap/autoload.php';
----------------------------------
Change:
$app = require_once __DIR__.'/../bootstrap/app.php';
to:
$app = require_once __DIR__.'/../laravel/bootstrap/app.php';

Note : And Last You remove all cache and cookies.

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

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

I hope you get an idea about Laravel Remove Public From URL Steps.
I would like to have feedback on my Pakainfo.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.