我正在使用Laravel 5.1,並將從我的URL中刪除公共。任何想法如何做到這一點,而不重命名文件?從URL Laravel 5.1中刪除公開URL
1
A
回答
1
你應該你的Web服務器(Nginx的,Apache的,等等)指向public
文件夾,而不是到root
文件夾(其中app
,config
,public
等生活)。
1
將您的網絡服務器的根目錄更改爲公用文件夾。
例如,NGINX配置低於:
server {
listen *:80;
server_name local.dev;
client_max_body_size 1m;
root /var/www/html/PROJECT/public;
index index.html index.htm index.php;
access_log /var/log/nginx/nxv_vfoa8j7qzdhl.access.log;
error_log /var/log/nginx/nxv_vfoa8j7qzdhl.error.log;
location/{
root /var/www/html/PROJECT/public;
try_files $uri $uri/ /index.php$is_args$args;
autoindex on;
index index.html index.htm index.php;
}
location ~ \.php$ {
root /var/www/html/PROJECT/public;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
try_files $uri $uri/ /index.php$is_args$args;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param APP_ENV dev;
}
sendfile off;
}
+0
爲什麼當這是一個非常好的答案時,這是低估? – ajtrichards
相關問題
- 1. Laravel4從URL中刪除公開
- 2. 從URL刪除index.php,Laravel 5.2
- 3. 試圖從URL中移除公共Laravel
- 4. 從Laravel的URL中刪除index.php
- 5. 從laravel url中刪除/public/index.php
- 6. 刪除laravel /公/從laravel
- 7. laravel刪除/公/ URL從並調用CSS和JavaScript時
- 8. laravel 5.1從mysql中刪除亂碼charachers
- 9. 從URL類加載器中刪除URL
- 10. 從url中刪除www
- 11. 從CodeIgniter URL中刪除index.php
- 12. 從cakephp url中刪除index.php
- 13. 從URL中刪除.htm
- 14. 從URL中刪除index.php?dir =?
- 15. 從url中刪除index.php Codeigniter
- 16. FileNotFoundException「/」從URL中刪除
- 17. 從url中刪除key = value
- 18. 從url中刪除參數
- 19. 從url中刪除?locale = en
- 20. htaccess從url中刪除print.html
- 21. 從URL中刪除部分
- 22. htaccess從url中刪除index.php
- 23. 從URL中刪除文件
- 24. Laravel 5.1刪除關係
- 25. Laravel 5周的.htaccess URL公衆刪除不工作
- 26. 刪除文件名「specification.php?URL =」從URL
- 27. 如何設置Laravel 5.1項目的url?
- 28. 刪除?從URL與htaccess
- 29. 從CodeIgniter 3 URL刪除index.php
- 30. 問題後刪除#從URL
要刪除嗎?在您的本地機器或任何現場服務器上? – Qazi
http://stackoverflow.com/questions/32806542/change-the-public-folder-of-laravel-5-1 –
@Steve,如果我的答案是有幫助的,請選擇我的答案作爲最佳答案,並upvote它。 –