[英]why laravel is not entering into public folder which contains index.php
我有一個problem
我的程序未進入公用文件夾。
我所做的是:
將server.php
更改為index.php
將css,js,images
移到root
文件夾,但copied
.htaccess copied
到root
文件夾
現在我的代碼以root身份進入index.php
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <taylor@laravel.com>
*/
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
return false;
}
echo __DIR__.'/public/index.php'; die; <-- for debuggig when i remove 500 error
require_once __DIR__.'/public/index.php';
死之前的上述代碼給出了 /home/ebsprint/public_html/enigma-crm/public/index.php
現在真正的問題(文件夾公共-文件)
public
- .htaccess
- index.php
文件夾里面的公共 index.php
<?php
echo 'here'; die;
給出500錯誤
問題 :在本地環境下工作正常,但是在托管時, 根 index.php
調用不會轉到public / index.php
只需添加.htaccess代碼,您無需更改Laravel目錄結構。 在根目錄下使用此代碼
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yourdomain.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.yourdomain.com$ [NC,OR]
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.