1

I want to remove public from my web URL simply step by step

I have done some steps already like copying the file from public the index and htaccess file but still I am getting not found page

3 Answers 3

5

I tried to solve this problem simply by making a .htaccess file. This file configures the apache server and solves the problem. Simply put this code in a file named '.htaccess' and save it in the root folder.

<IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule> RewriteEngine On RewriteCond %{REQUEST_FILENAME} -d [OR] RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^ ^$1 [N] RewriteCond %{REQUEST_URI} (\.\w+$) [NC] RewriteRule ^(.*)$ public/$1 RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ server.php </IfModule> 
Sign up to request clarification or add additional context in comments.

1 Comment

But this solution creates issues with Passport authentication.
2

If you have done 2 steps already have you change the index.php having vendor folder path inside remove the /../ and everything work fine

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

to

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

Comments

0

It's possible to remove public from url in laravel5. Follow these steps:

step 1 : copy all file from public and paste on root directory

step 2 : open index.php file replace with

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'; 

Then Remove all cache and cookies.

php artisan cache:clear 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.