2015-09-26 38 views
3

我在控制器中編寫了下面的代碼。帶斜線的代碼正在工作,但帶有引用的代碼不起作用。Laravel 5路由只能用斜線工作

我獲得500內部服務器錯誤,每當我不使用斜線

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

Route::get('welcome', function() 
{ 
    return 'Welcome Page'; 
}); 

以下是我的.htaccess文件

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

    RewriteEngine On 

    RewriteEngine On RewriteBase 

    # Redirect Trailing Slashes... 
    RewriteRule ^(.*)/$ /$1 [L,R=301] 

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

以下是conf文件

Alias /pitcher.dev "C:/wamp/www/pitcher.dev/public/" 

<Directory "C:/wamp/www/pitcher.dev/public/"> 
    Options Indexes FollowSymLinks MultiViews 
    AllowOverride all 
     Order allow,deny 
    Allow from all 
</Directory> 

我正在使用Windows和wamp服務器。 mod_rewrite已啓用。

+0

運行'php artisan route:clear'來確保你的路由沒有被緩存。 – patricus

+0

我試過了,但仍然沒有工作 –

+0

那麼,什麼是「不工作」?你有404嗎?黑屏? 500?等... – patricus

回答

0

嘗試刪除此行RewriteEngine On RewriteBase,當您的.htaccess代碼錯誤時,發生AFAIK 500內部服務器錯誤。 :D

嘗試更改Options Indexes FollowSymLinks MultiViewsOptions Indexes FollowSymLinks

+0

我已經嘗試刪除'RewriteEngine on RewriteBase',但它也沒有工作。 –

+0

@StephenPul答案更新。嘗試一下:D –