2015-08-26 161 views
2

我得到了一個錯誤說未找到在此服務器上未找到請求的URL/about。 laravel路線

未找到

所請求的網址/關於此服務器上找到。

我有這樣的路線

Route::get('/', '[email protected]'); 
Route::get('home', '[email protected]'); 
Route::get('about', '[email protected]'); 
Route::get('loan-products', '[email protected]'); 
Route::get('careers', '[email protected]'); 
Route::get('contact', '[email protected]'); 

如果我不「PHP工匠路線:列表」我可以看到,這些路線是否真的存在。我在運行wamp服務器上存在該問題的地方(活網絡服務器上的問題相同),但是如果我通過「php artisan serve」運行我的應用程序,所有頁面都可以運行。任何想法,幫助?這個路線:Route :: get('/','megamitch @ index');「作品。

+2

'/ index.php/about'有效嗎?如果是這樣,那麼你的apache配置不會重寫URL。 – BrokenBinary

+0

是的,它工作,如何即時配置Apache配置,以便它會重寫URL或什麼是修復? –

回答

1

這聽起來像你的重寫不起作用。如果您在​​之前將index.php添加到URL之前是否有效?

例如,yourdomain.com/about將成爲yourdomain.com/index.php/about

如果你的重寫不工作,但你有.htaccess文件在您public目錄,那麼你可能需要允許在Apache配置覆蓋。以下是WAMP和Laravel的示例虛擬主機配置。

我已經標記了需要更改的行。將第一個和第三個更改爲指向您網站目錄中的public目錄。然後將第二行更改爲您在網站上使用的域名。

<VirtualHost *:80> 
    DocumentRoot "C:/wamp/www/yourdomain/public"  # Change this line 
    ServerName yourdomain.com       # Change this line 
    <Directory "C:/wamp/www/yourdomain/public">  # Change this line 
     Options Indexes FollowSymLinks ExecCGI Includes 
     AllowOverride All # This line enables .htaccess files 
     Order allow,deny 
     Allow from all 
    </Directory> 
</VirtualHost> 

您需要重新啓動Apache才能使這些設置生效。

+0

即時錯過了一個httaccess他/ pulic /解決問題。 –

+0

此解決方案(爲虛擬主機啓用mod_rewrite)適用於我:http://askubuntu.com/a/423549/493153 –

相關問題