301 Redirect Problems

Hi @teefers I tested the code this morning. The ‘single page to folder with subpages’ and the ‘single page to single page’ redirects worked fine however I couldn’t get the ‘multiple sub pages to single page’ code to work for all possible pages - this was the code…

RedirectMatch 301 ^/gifts-dog-lovers/dog-sayings-word-art/(.*) /gifts-dog-lovers/inspirational-dog-wisdom-life-quotes-prints/

I tested it on the excellent htaccess code tester as recommended by @joeworkman

It worked for these URLs
https://www.theenlightenedhound.com/gifts-dog-lovers/dog-sayings-word-art/
https://www.theenlightenedhound.com/gifts-dog-lovers/dog-sayings-word-art/print-1

but not for this one

https://www.theenlightenedhound.com/gifts-dog-lovers/dog-sayings-word-art

I guess because there was no / at the end?? but that is a possible URL that could be searched so I have to address it

So I just wrote a 301 for each of my single pages separately to be sure all bases are covered … not too much of an issue as there are only 15

The great thing with the code you shared is not just that it works :ok_hand: but also that it doesn’t generate the extra / on the redirected page if the user puts a / at the end of the page url they were looking for… so that is great -thanks so much

So in summary, if this helps anyone else, then this is the code from Doug that I used:

Redirecting a single page to a folder with subpages:

RedirectMatch 301 ^/folder-name/page-name /new-folder-name$1

in my case this was the following…

RedirectMatch 301 ^/gifts-dog-lovers/dog-is-my-co-pilot-print /gifts-dog-lovers$1

Redirecting a single page to another single page

RedirectMatch 301 ^/folder-name/page-name /new-folder-name/new-page-name

in my case this was the following…

RedirectMatch 301 ^/gifts-dog-lovers/dog-sayings-word-art /gifts-dog-lovers/inspirational-dog-wisdom-life-quotes-prints

Thank you so much again for your help. I had a massive headache yesterday after a full day of trying to sort this out so I am very happy today!!