jeudi 28 septembre 2017

Laravel 301 Redirects

How can I get 301 Redirects to work with the public .htaccess file? It seems like it wont work because of the trailing backslash?

.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://ift.tt/2xJBUlb
    Redirect 301 /old-page-3/ http://ift.tt/2xJBUlb
    Redirect 301 /old-page-4/ http://www.mysite1.com
    Redirect 301 /old-page/old-page/ http://ift.tt/2xJBUlb

</IfModule>

but it I change it for testing to say:

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

that will redirect fine. The issue is I need those trailing slash since google has the old links that way.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2fvHUUU
via IFTTT

Aucun commentaire:

Enregistrer un commentaire