2015-09-27 66 views
0

我可以通過http://localhost/rnd/public/coeg-admin訪問我的網址,但是如果我訪問http://localhost/rnd/public/coeg-admin/,它會被重定向到http://localhost/coeg-adminLaravel 5:帶尾部斜槓的URL被重定向到本地主機

我只是按照laravel trailing Slashes redirect to localhostURL with trailing slashes gets redirected to localhost in laravel 5

但它不能按預期工作,這是我的.htaccess

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

    RewriteEngine On 

    # Set base URL 
    # RewriteBase /rnd/public/ 
    # RewriteRule ^(.*)/$ /$1 [L,R=301] 
    # RewriteCond %{REQUEST_URI} !^ 

    # 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] 
</IfModule> 

這裏是我的apache2.conf

<Directory "/var/www/html/rnd/public"> 
     Options Indexes FollowSymLinks 
     #AllowOverride None 
     AllowOverride All 
     Require all granted 
</Directory> 

<Directory "/var/www/html"> 
     Options Indexes FollowSymLinks 
     AllowOverride All 
     Require all granted 
</Directory> 

如何,我也可以把帶末尾斜線的網址到最後沒有斜線的網址?

謝謝,任何幫助表示讚賞。

回答

1

我是從去除RewriteRule ^(.*)/$ /$1 [L,R=301]最簡單的方式,爲公衆/的.htaccess

不要忘記清除緩存也是如此,因爲鉻重定向緩存保存在瀏覽器太

相關問題