2017-07-20 38 views
0

上找不到我做了一個網站,laravel和轉發我的域名到項目的文件夾中。然而,當我進入網站就說明我的錯誤:Laravel請求的URL /該服務器

<?php 
$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; 
} 

require_once __DIR__.'/public/index.php'; 

的.htaccess:

<IfModule mod_rewrite.c> 
    <IfModule mod_negotiation.c> 
     Options -MultiViews 
    </IfModule> 

    RewriteEngine On 

    # Redirect Trailing Slashes If Not A Folder... 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)/$ /$1 [L,R=301] 

    # Handle Front Controller... 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule^index.php [L] 

    # Handle Authorization Header 
    RewriteCond %{HTTP:Authorization} . 
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 
</IfModule> 
找不到404 請求的URL /沒有被這臺服務器

Server.php上找到

的index.php:

require __DIR__.'/../bootstrap/autoload.php'; 

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

編輯#1

我發了的public_html文件夾,並放置laravel /公共的內容在它。改變了使用'/../laravel/bootstrap/app.php'和'/../laravel/bootstrap/autoload.php'的路徑。當我現在進入網站時,它會給我提供HTTP 500錯誤

+2

「我做了一個網站,laravel和轉發我的域名到項目的文件夾。」您應該將該域名指向項目的「公共」文件夾。在Laravel項目的根目錄中沒有'index.php',它位於'public'目錄中。 – ceejayoz

+0

基本上你說你採用了laravel默認'index.php'並從中刪除了重要的東西? – apokryfos

+0

我沒有,只是顯示的重要線路 – jordibenck

回答

1

將更改的文件還原爲默認值,並將虛擬主機指向public文件夾。