PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, February 16, 2022

[FIXED] How to run Laravel from root directory, not from public?

 February 16, 2022     laravel, laravel-5.2     No comments   

Issue

By default, Laravel project is run from public directory, for this I must enter URL like as:

http://localhost/public/

How to configure Laravel that website will be appeared from: http://localhost/?


Solution

•Go to mainproject/public>>

a.  .htacess
b.  favicon.ico
c.  index.php
d.  robots.txt
e.  web.config

1.cut these 5 files from the public folder, and then paste on the main project folder that’s means out side of public folder… mainproject/files

2.Next after paste ,open index.php ,modify

•require __DIR__.'/…/bootstrap/autoload.php';  to
•require __DIR__.'/bootstrap/autoload.php';
  1. modify

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

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

you can also watch this video for better understanding----------------

https://www.youtube.com/watch?v=GboCYqEbKN0



Answered By - Borna
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing