Laravel 301重定向

时间:2017-09-28 22:45:58

标签: laravel .htaccess redirect laravel-5

如何让301重定向与公共.htaccess文件一起使用?由于尾随反斜杠似乎无法正常工作?

.hataccess

<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}]

    Redirect 301 /old-page/ http://www.mysite1.com
    Redirect 301 /old-page-1/ http://www.mysite1.com/join-the-team
    Redirect 301 /old-page-3/ http://www.mysite1.com/join-the-team
    Redirect 301 /old-page-4/ http://www.mysite1.com
    Redirect 301 /old-page/old-page/ http://www.mysite1.com/join-the-team

</IfModule>

但是我改变它以便测试说:

Redirect 301 /old-page/no-slash http://www.mysite1.com

将重定向罚款。问题是我需要那些尾随斜杠,因为谷歌有这样的旧链接。

0 个答案:

没有答案