htaccess rule for redirecting homepage breaks other redirect rules
-
Hello there,
I just did a redesign of a website. New domain, new structure.
For SEO purposes I know I have to redirect the old URL to the new domain. So i toyed a bit with screaming frog SEO spider and Google analytics and got a nice list of pages that need to be redirected.
I need to redirect only about 30 pages.
I used this syntax in .htaccess.Redirect 301 /annalisa-mantovani-2/ https://www.annalisamantovani.com/bio/ Redirect 301 /progetti/ https://www.annalisamantovani.com/portfolio/
And It works.
ie: https://svistadecorazionigrafiche.com/progetti (OLD URL) correctly redirects to https://www.annalisamantovani.com/portfolio (NEW URL)
But there’s an issue that occurs if I add the homepage redirect. If I add
Redirect 301 / https://www.annalisamantovani.com
The homepage gets redirected correctly but all the other redirects stop working.
ie: https://svistadecorazionigrafiche.com/progetti redirects to https://www.annalisamantovani.comprogetti/ (and It clearly doesn’t work)
The htaccess file on the old domain looks pretty plain and simple, like straight out of the codex. Here’s how it looks:
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] (... redirect rules) Redirect 301 /Progetti/quadri-schiena-donna/ https://www.annalisamantovani.com/portfolio/vivi/ Redirect 301 /Progetti/sanbucus-nigra/ https://www.annalisamantovani.com/portfolio/sambucus-nigra/ </IfModule> # END WordPress
Probably it’s an easy fix that has something to do with the code at the beginning of the htaccess. But I can’t understand that even after some hard googling.
If someone that knows more than me can point me in the right direction it would be great.
Thank you!
- The topic ‘htaccess rule for redirecting homepage breaks other redirect rules’ is closed to new replies.