jeudi 20 février 2020

How do I keep parameters from being added to the end of my new url in a 301 redirect?

We have a Laravel site going up and I'm trying to write the 301 redirects for the old urls.

The issue I've been having, using RedirectMatch is that the parameter is getting added to the new url, which invalidates that url.

With RewriteRule, I can prevent that from happening. But I can't seem to get RewriteRule to work at all.

Below is my htaccess. I really appreciate any insight. I have a lot to cover and a reliable pattern is critical.

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews -Indexes
</IfModule>
Options +FollowSymLinks
RewriteEngine On


RewriteRule ^/help-.*$ /faq? [R=301,L]

#RedirectMatch 301 ^/help-.*?$ /faq

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


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire