Results 1 to 20 of 20
  1. #1
    DaftDog's Avatar
    DaftDog is offline Private Member
    Join Date
    October 2008
    Location
    South Africa
    Posts
    2,174
    Thanks
    701
    Thanked 780 Times in 468 Posts

    Default Merging Site A to Site B

    I'm not a coder so I'd appreciate some assistance from the more tech savvy members on the forum, if possible.

    I'm moving content from a thin website (Site A) to an existing website (Site B), would the following 301 redirects be the correct format to use in my htaccess file on Site A?

    Code:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    Redirect 301 /some-page1/ https://www.siteb.com/new-post-name/
    Redirect 301 /some-page2/ https://www.siteb.com/new-post-name2/
    
    </IfModule>

  2. #2
    chaumi is offline Private Member
    Join Date
    October 2013
    Location
    East Midlands
    Posts
    1,640
    Thanks
    571
    Thanked 841 Times in 617 Posts

    Default

    Apologies if this is a daft suggestion...(and the more I think about it, it probably is otherwise you probably wouldn't be asking) but if A is on WP there are plugins that will do it for you without having to code it

  3. #3
    DaftDog's Avatar
    DaftDog is offline Private Member
    Join Date
    October 2008
    Location
    South Africa
    Posts
    2,174
    Thanks
    701
    Thanked 780 Times in 468 Posts

    Default

    Quote Originally Posted by chaumi View Post
    Apologies if this is a daft suggestion...(and the more I think about it, it probably is otherwise you probably wouldn't be asking) but if A is on WP there are plugins that will do it for you without having to code it
    Not a daft question at all.

    I don't want to maintain an entire WordPress setup when there is a more economical method of just using an .htaccess file.

  4. #4
    chaumi is offline Private Member
    Join Date
    October 2013
    Location
    East Midlands
    Posts
    1,640
    Thanks
    571
    Thanked 841 Times in 617 Posts

    Default

    OK if no one answers with the coding way what you could try is set one up with a plugin, look in the code at how it did it, then copy for individual pages. The assumption of course is that a plugin does it the same/appropriate way, but it sounds logical.

  5. The Following User Says Thank You to chaumi For This Useful Post:

    DaftDog (5 February 2021)

  6. #5
    DaftDog's Avatar
    DaftDog is offline Private Member
    Join Date
    October 2008
    Location
    South Africa
    Posts
    2,174
    Thanks
    701
    Thanked 780 Times in 468 Posts

    Default

    Quote Originally Posted by chaumi View Post
    OK if no one answers with the coding way what you could try is set one up with a plugin, look in the code at how it did it, then copy for individual pages. The assumption of course is that a plugin does it the same/appropriate way, but it sounds logical.
    It appears that the WP plugins do the redirects via php, as there have no redirect additions in my htaccess file.

  7. #6
    chaumi is offline Private Member
    Join Date
    October 2013
    Location
    East Midlands
    Posts
    1,640
    Thanks
    571
    Thanked 841 Times in 617 Posts

    Default

    worth a try I guess

    Sounds too easy...but I found this....

    https://css-tricks.com/snippets/htaccess/301-redirects/


    This might help for more explanation https://linchpinseo.com/htaccess-rules/

  8. #7
    DaftDog's Avatar
    DaftDog is offline Private Member
    Join Date
    October 2008
    Location
    South Africa
    Posts
    2,174
    Thanks
    701
    Thanked 780 Times in 468 Posts

    Default

    @chaumi - thanks for assisting, but I've decided to use my SEO plugin to create the redirects. I only have to keep the redirects in place for 180 days and after that, I can shut the old site down.

  9. #8
    chaumi is offline Private Member
    Join Date
    October 2013
    Location
    East Midlands
    Posts
    1,640
    Thanks
    571
    Thanked 841 Times in 617 Posts

    Default

    Yeah the easy way. In theory might not need that long, any pages I've redirected in the past have been picked up and show with the new page in search results within a maximum of a few weeks, normally just days.

    But we both learned something that might come in handy another time!

  10. #9
    Inersha is offline Private Member
    Join Date
    August 2007
    Posts
    20
    Thanks
    6
    Thanked 6 Times in 4 Posts

    Default

    Quote Originally Posted by DaftDog View Post
    I'm not a coder so I'd appreciate some assistance from the more tech savvy members on the forum, if possible.

    I'm moving content from a thin website (Site A) to an existing website (Site B), would the following 301 redirects be the correct format to use in my htaccess file on Site A?

    Code:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    Redirect 301 /some-page1/ https://www.siteb.com/new-post-name/
    Redirect 301 /some-page2/ https://www.siteb.com/new-post-name2/
    
    </IfModule>
    Yes this will work perfectly fine.

    I would recommend using .htaccess to set up the redirects instead of using a WP plugin if you can. If you ever needed to change host/server you would only need to upload the .htaccess file, whereas with the plugin you would need to maintain an entire wordpress installation just to keep the redirects in place.

    Also, it's a good idea to redirect images alongside your pages. Images get indexed and can bring in some traffic, so it's useful to point them to their new home as well.

  11. The Following 2 Users Say Thank You to Inersha For This Useful Post:

    chaumi (5 February 2021), DaftDog (9 February 2021)

  12. #10
    DaftDog's Avatar
    DaftDog is offline Private Member
    Join Date
    October 2008
    Location
    South Africa
    Posts
    2,174
    Thanks
    701
    Thanked 780 Times in 468 Posts

    Default

    Quote Originally Posted by Inersha View Post
    Yes this will work perfectly fine.

    I would recommend using .htaccess to set up the redirects instead of using a WP plugin if you can. If you ever needed to change host/server you would only need to upload the .htaccess file, whereas with the plugin you would need to maintain an entire wordpress installation just to keep the redirects in place.

    Also, it's a good idea to redirect images alongside your pages. Images get indexed and can bring in some traffic, so it's useful to point them to their new home as well.
    @Inersha - thanks for the feedback.

  13. #11
    baldidiot is offline Private Member
    Join Date
    January 2010
    Posts
    5,100
    Thanks
    433
    Thanked 2,333 Times in 1,555 Posts

    Default

    I'm no htaccess expert but I believe that this:

    Code:
    Redirect 301 /page-1/ https://www.whatever.com/page-1/
    Is also going to catch anything after the /page-1/, eg:

    Code:
    /page-1/sub-page/ ---> https://www.whatever.com/page-1/sub-page/
    If you're just copying the site structure as is then it doesn't really matter but if you have any kind of variation you could end up with redirects you weren't expecting.

    If it's an issue I think you can lock it to the end using $, eg: /page-1/$

    You can also use ^ to anchor to the start if needed.
    onlinegamblingwebsites.com - Formally known as goodbonusguide.

    Gambling Domains: Small clear out of some of the domains we've been hoarding - see the spreadsheet here.

  14. The Following User Says Thank You to baldidiot For This Useful Post:

    DaftDog (10 February 2021)

  15. #12
    Michael Martinez is offline Public Member
    Join Date
    March 2017
    Location
    USA
    Posts
    79
    Thanks
    9
    Thanked 55 Times in 31 Posts

    Default

    Quote Originally Posted by baldidiot View Post
    I'm no htaccess expert but I believe that this:

    Code:
    Redirect 301 /page-1/ https://www.whatever.com/page-1/
    Is also going to catch anything after the /page-1/, eg:
    RedirectMatch would do that, or a wildcard pattern. DaftDog's code is correct for 1-to-1 redirects.

  16. The Following User Says Thank You to Michael Martinez For This Useful Post:

    DaftDog (10 February 2021)

  17. #13
    baldidiot is offline Private Member
    Join Date
    January 2010
    Posts
    5,100
    Thanks
    433
    Thanked 2,333 Times in 1,555 Posts

    Default

    Quote Originally Posted by Michael Martinez View Post
    RedirectMatch would do that, or a wildcard pattern. DaftDog's code is correct for 1-to-1 redirects.
    I've just checked on a site we have a bunch of redirects on and it's definitely happening when using "Redirect 301". This is the code (changed slightly to hide the site):

    Code:
    Redirect 301 /thepage/ https://www.example.com/parent/newpage/
    If I visit this:

    /thepage/test/

    It takes me to:

    https://www.example.com/parent/newpage/test/
    onlinegamblingwebsites.com - Formally known as goodbonusguide.

    Gambling Domains: Small clear out of some of the domains we've been hoarding - see the spreadsheet here.

  18. The Following User Says Thank You to baldidiot For This Useful Post:

    DaftDog (10 February 2021)

  19. #14
    Michael Martinez is offline Public Member
    Join Date
    March 2017
    Location
    USA
    Posts
    79
    Thanks
    9
    Thanked 55 Times in 31 Posts

    Default

    DaftDog's example specifies a PAGE - a single URL, not a directory name. I think that's where the confusion is arising.

    These are the rules Apache publishes, although what the individual user can do depends on the server configuration.

    Redirecting and Remapping with mod_rewrite - Apache HTTP Server Version 2.4

    ADDED ON EDIT:

    Technically, the original example provided specifies [WordPress] POST to POST redirect. In WordPress, a Page can have children (even if not being a directory name). But a Post cannot.
    Last edited by Michael Martinez; 9 February 2021 at 2:40 pm.

  20. #15
    baldidiot is offline Private Member
    Join Date
    January 2010
    Posts
    5,100
    Thanks
    433
    Thanked 2,333 Times in 1,555 Posts

    Default

    I'm obviously missing something as I don't see the difference between the two scenarios.

    In both cases we're talking about a plain .htaccess file (ie: no wordpress install) so surely /old-page/ and /old-directory/ would be treated equally in htaccess?

    My redirect was also a single URL that used to be a page on an old wordpress install, so it's exactly what daftdog is talking about. I guess that's what's confusing me about your comment.

    Like I said though, I'm no htaccess expert just mentioning something that cropped up for me when doing the same thing as the OP.
    onlinegamblingwebsites.com - Formally known as goodbonusguide.

    Gambling Domains: Small clear out of some of the domains we've been hoarding - see the spreadsheet here.

  21. The Following User Says Thank You to baldidiot For This Useful Post:

    DaftDog (10 February 2021)

  22. #16
    Michael Martinez is offline Public Member
    Join Date
    March 2017
    Location
    USA
    Posts
    79
    Thanks
    9
    Thanked 55 Times in 31 Posts

    Default

    I took DaftDog's example literally - the URLs in his example represent individual Post URLs. Even though they are terminated by a "/", Post URLs cannot have any child or subordinate URLs:

    example.tld/post-url/

    example.tld/post-url/child-url <-- Blog content management systems won't do this.

    Hence, a Redirect directive in the Apache .htaccess file in the following format won't ever affect anything but a single URL:

    Redirect 301 /post-url/ https://example.tld/new-url/

    There's nothing else under the Post URL - no tree, hierarchy, directory, etc.

    Call it a special case. It's not because of some rule in Apache but because of the way blogs work.

    It's perfectly correct to point out that redirecting a URL with child URLs should cause the child URLs to also redirect. But that won't apply to the situation that DaftDog's example illustrates. There's nothing else to redirect.

  23. The Following User Says Thank You to Michael Martinez For This Useful Post:

    DaftDog (10 February 2021)

  24. #17
    DaftDog's Avatar
    DaftDog is offline Private Member
    Join Date
    October 2008
    Location
    South Africa
    Posts
    2,174
    Thanks
    701
    Thanked 780 Times in 468 Posts

    Default

    Thanks for all the feedback, it's fascinating to read.

    As I mentioned previously, I decided to use my SEO plugin to do the redirects. I set a redirect for each post, page, category and tags. The posts or pages I did not want to redirect I just set them with a 410 error code.

    Edit:
    Google recommends keeping the redirects in place for 180 days after which they will no longer associate the old site url's with the new site url's.

  25. #18
    baldidiot is offline Private Member
    Join Date
    January 2010
    Posts
    5,100
    Thanks
    433
    Thanked 2,333 Times in 1,555 Posts

    Default

    Quote Originally Posted by Michael Martinez View Post
    I took DaftDog's example literally - the URLs in his example represent individual Post URLs. Even though they are terminated by a "/", Post URLs cannot have any child or subordinate URLs:
    They're talking about redirecting a whole site though and there's loads of possible child URLs formats:

    - Pages
    - Custom post types (we use custom posts that have children)
    - Attachments
    - Categories
    - Custom permalink structures (ie: if they have all posts as /blog/post-name/)

    Plus if they're using an affiliate style theme that has specific reviews there's also the possibility of a /casino/ and /casino/name-review/ type format.

    All of the above could cause issues if the redirect isn't a true like for like (ie: if /casino/ goes to /best-casinos/ and /casino/mycasino-review/ goes to /reviews/mycasino/).



    DaftDog - glad you got it sorted. Just remember to keep the old WP install up to date even though it's not an active site any more! Personally I'd just replace with a htaccess file though - does the seo plug in offer the ability to export your redirects? Could easily build it from that.
    onlinegamblingwebsites.com - Formally known as goodbonusguide.

    Gambling Domains: Small clear out of some of the domains we've been hoarding - see the spreadsheet here.

  26. The Following User Says Thank You to baldidiot For This Useful Post:

    DaftDog (11 February 2021)

  27. #19
    Michael Martinez is offline Public Member
    Join Date
    March 2017
    Location
    USA
    Posts
    79
    Thanks
    9
    Thanked 55 Times in 31 Posts

    Default

    Quote Originally Posted by baldidiot View Post
    They're talking about redirecting a whole site though and there's loads of possible child URLs formats:
    We're talking about apples and oranges here. I've explained what I was addressing, which is a scenario (as illustrated in the original post) where there is no chance of child URLs.

    There is nothing to disagree about. There is no reason to keep arguing.

  28. #20
    DaftDog's Avatar
    DaftDog is offline Private Member
    Join Date
    October 2008
    Location
    South Africa
    Posts
    2,174
    Thanks
    701
    Thanked 780 Times in 468 Posts

    Default

    Quote Originally Posted by Michael Martinez View Post
    We're talking about apples and oranges here. I've explained what I was addressing, which is a scenario (as illustrated in the original post) where there is no chance of child URLs.

    There is nothing to disagree about. There is no reason to keep arguing.
    I don't think he's arguing, just having a discussion. Turns out I may have not been to clear on my opening post, so I have learnt quite a bit from all comments in this thread.

  29. The Following 2 Users Say Thank You to DaftDog For This Useful Post:

    baldidiot (12 February 2021), universal4 (11 February 2021)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •