2017-06-05 119 views
0

我正在運行的XAMPP laravel和我有問題,訪問的網頁, http://localhost/laravel/public/我得到一個登錄頁面,這是很好 但是當我去例如http://localhost/laravel/public/smokeyardXAMPP本地主機不工作

我得到404誤差The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

路線:

Route::get('smokeyard', '[email protected]'); 

控制器:

function smokeyard(){ 
    return view('smokeyard'); 
} 

我的所有視圖都位於資源文件夾中。

+0

1.檢查Apache的mod_rewrite的啓用網址。 2.從cmd轉到您的項目文件夾。運行--php artisan serve命令並運行你的本地環境http:// localhost:8000 - 你的所有路徑都可以運行 3. use:public/index.php/。 –

+0

如果您使用php artisan serve,它仍然使用xampp的mysql模塊嗎? – Przemek

+0

是的mysql和工匠沒有任何連接。 –

回答

3

,如果你不想運行artisan serve訪問laravel項目,您需要更改一些設置,

  1. public folderpaste它複製.htaccess文件在你application

  2. root folderrenameserver.phproot directory to index.php

現在去localhost/your_project_name/smokeyard您要檢查

希望這有助於

0

運行php artisan serve並訪問您的服務器http://localhost:8000。那麼你的路線應該工作得很好。

您無法直接通過xampp文件夾結構訪問您的laravel應用程序路徑。您需要設置web根目錄指向public文件夾並訪問localhost或運行laravel服務器並使用它。這是因爲當你以laravel的方式訪問路由時,URL重寫會失敗。