jeudi 30 janvier 2020

Redirect in Laravel .htaccess

I am beginner in Laravel. I use in my project Laravel 5.8. I make new website (old website was delete)

I have .htaccess:

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

    RewriteEngine On
    # Redirect to https
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://domain.pl/$1 [R,L]

    # Redirect to non www
    RewriteCond %{HTTP_HOST} ^www.domain.pl$ [NC]
    RewriteRule ^(.*)$ https://domain.pl/$1 [R=301,L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

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

    # Fonts
    # Add correct content-type for fonts
    AddType application/vnd.ms-fontobject .eot
    AddType application/x-font-ttf .ttf
    AddType application/x-font-opentype .otf
    AddType application/x-font-woff .woff
    AddType image/svg+xml .svg

    ExpiresActive On
    ExpiresByType image/jpg "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/pdf "access plus 1 month"
    ExpiresByType text/javascript "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
    ExpiresByType application/x-javascript "access plus 1 month"
    ExpiresByType application/x-shockwave-flash "access plus 1 month"
    ExpiresByType image/x-icon "access plus 1 month"
    ExpiresByType image/ico "access plus 1 month"

    ExpiresByType text/css "access plus 1 month"
    ExpiresByType text/css "now plus 1 month"
    ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
    ExpiresByType application/x-font-ttf "access plus 1 month"
    ExpiresByType application/x-font-opentype "access plus 1 month"
    ExpiresByType application/x-font-woff "access plus 1 month"
    ExpiresByType image/svg+xml "access plus 1 month"
    ExpiresByType text/html "access plus 600 seconds"

    ExpiresDefault "access plus 2 days"

</IfModule>

This work fine.

I need add to this .htaccess:

  1. Redirect from https://domain.pl/oferta (error 404 - page not exist in new website) to https://domain.pl/oferta-2020 , https://domain.pl/kontakt to https://domain.pl/contact

  2. Redirect other error 404 to main page: https://domain.pl

How can I make it?



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

Aucun commentaire:

Enregistrer un commentaire