http://tutsnare.com/remove-public-from-url-laravel/
Remove public from url laravel 5 and Lower versions:-
Default laravel access url will be http://example.com/public/. so you need to remove “public” from url to get clean urls in laravel 5. let’s check how to remove public from url in laravel.
There is two solution to remove public from url laravel :-
1. Using .htaccess :-
Add following code in your .htaccess (if not exist create a .htaccess on laravel root directory)
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
2. using content moving :-
It’s a better and simple method to remove public from url laravel below are the steps to do this:-
1. Create a folder on root with named local(you can give any name).
2. Move all files except public folder in the local folder.
3. Move all the files of public to root directory and remove blank public folder.
so directory structure will be :-
Root
a. local – which have all root files except public folder
b. all files of public folder.
laravel(root)
-- local
-- app
-- boostrap
-- .gitattributes
-- composer.json
-- server.php
-- and so on ----
-- packages
-- .htaccess
-- favicon.ico
-- index.php
-- robots.txt
4. Now time to change some paths:-
Note:- Skip step (a) to remove public from url in laravel 5.
In laravel 5 directory structure has been changed also you will not found paths.php in bootstrap so this step need to be skip for laravel 5.
a. open local/bootstrap/paths.php and find below code
'public' => __DIR__.'/../public',
change with below code
'public' => __DIR__.'/../../',
b. open index.php (on root) and find below code
require __DIR__.'/../bootstrap/autoload.php';
$app = require_once __DIR__.'/../bootstrap/start.php';
change with below code
require __DIR__.'/local/bootstrap/autoload.php';
$app = require_once __DIR__.'/local/bootstrap/start.php';
Now you have all set you can access url http://example.com/ if still problem try with clear cache of browser.
Remove public from url laravel
前往
- Software
- ↳ CodeCharge Studio
- ↳ CodeCharge
- ↳ DemoCharge
- ↳ SuperPDF
- ↳ 551einv
- ↳ E3進銷存
- 程式語言
- ↳ PHP
- ↳ CodeLobster PHP Edition
- ↳ Yii
- ↳ CodeIgniter
- ↳ Phalcon
- ↳ Symfony
- ↳ FuelPHP
- ↳ Zend Framework 2
- ↳ laravel
- ↳ WordPress
- ↳ ASP.NET/C#
- ↳ ASP/VBScript
- ↳ JSP
- ↳ Java Servlets
- ↳ ColdFusion
- ↳ Perl
- ↳ Java Script
- ↳ jQuery
- ↳ HTML + CSS
- ↳ jQuery
- ↳ nodejs
- ↳ VB6
- ↳ Git
- ↳ App Inventor 2
- ↳ bash
- ↳ C++/ VC/ OpenCV
- ↳ OpenCV
- ↳ go
- ↳ cordova
- ↳ python
- ↳ Xamarin
- ↳ Assembly
- 資料庫
- ↳ MySQL
- ↳ PostgreSQL
- ↳ ORACLE
- ↳ Access
- ↳ SQL Server
- ↳ SQLite
- ↳ MariaDB
- ↳ Mongodb
- 作業系統
- ↳ Linux
- ↳ Ubuntu
- ↳ CentOS
- ↳ Mint
- ↳ Mandriva
- ↳ Debian
- ↳ Red Hat Enterprise Linux
- ↳ Oracle Linux
- ↳ Fedora
- ↳ Kali Linux
- ↳ OpenSUSE
- ↳ Elementary OS
- ↳ Microsoft
- ↳ Server 2008 R2
- ↳ Server 2012 R2
- ↳ Server 2012
- ↳ 8
- ↳ 10
- ↳ System Center 2016
- ↳ NOVELL
- ↳ FreeBSD
- ↳ VMware
- ↳ VirtualBox
- ↳ Mac OS X
- ↳ Solaris
- ↳ iOS
- ↳ Android
- ↳ Cloud
- ↳ OpenStack
- ↳ Docker
- ↳ Proxmox VE
- ↳ CloudReady
- ↳ chrome
- 網頁伺服器
- ↳ apache
- ↳ tomcat
- ↳ nginx
- ↳ IIS
- ↳ JBoss
- ↳ weblogic
- ↳ WebHosting
- 硬體
- ↳ 硬體及週邊
- ↳ RouterOS
- ↳ LEGO NXT
- ↳ Arduino
- ↳ MSP430
- ↳ Raspberry Pi
- ↳ OpenERP
- ↳ Storage
- ↳ Server
- ↳ Brocade
- ↳ MODELS
- ↳ FortiGate
- 軟體
- ↳ sublime
- ↳ LibreNMS