Results 1 to 13 of 13
  1. #1
    MJM
    MJM is offline Private Member
    Join Date
    November 2010
    Posts
    961
    Thanks
    189
    Thanked 550 Times in 318 Posts

    Default Need Some Help - Converting To A New Domain and 301 Redirects

    Hello all, it's been years since I've done this so I wanted to run it past everyone to see if I have this right.

    I bought a better domain for one of our sites and want to move it to the new domain. I've already cloned Site A to Site B and it's setup and ready to go - I just need to finish the process by redirecting all pages of Site A to Site B.

    My understanding is there is two ways to do this:

    1. Page to page 1 on 1 301 redirects aka SiteA.com/page-123/ to SiteB.com/page-123/

    However, am I correct in understanding if the structure, layout, and url folders are all staying the same aka no url changes we can do a simpler global 301 redirect and save the time of making a a file of a couple hundred urls in the 1 on 1 option?

    Hope I wrote this in a way that makes sense. Site A has established traffic and rankings, but very few links to internal pages to worry about. Help appreciated from those smarter than me!

  2. #2
    universal4's Avatar
    universal4 is online now Forum Administrator
    Join Date
    July 2003
    Location
    Courage is being scared to death...and saddling up anyway. John Wayne
    Posts
    33,991
    Thanks
    4,543
    Thanked 9,297 Times in 5,981 Posts

    Default

    There is a variable you can use in htaccess that will take the page name from one and tack on the the new domain is one shot....

    I am sure one of the members that does this more can help pretty quick...

    I was thinking it was a $ sign, but I might be incorrect about that.

    Rick
    Universal4

  3. The Following User Says Thank You to universal4 For This Useful Post:

    Cash Bonus (15 February 2018)

  4. #3
    universal4's Avatar
    universal4 is online now Forum Administrator
    Join Date
    July 2003
    Location
    Courage is being scared to death...and saddling up anyway. John Wayne
    Posts
    33,991
    Thanks
    4,543
    Thanked 9,297 Times in 5,981 Posts

    Default

    I "think" you want the 1st example here, but you might confirmation of that.
    https://stackoverflow.com/questions/...-to-new-domain


    Be sure while testing, keep closing and reopening different browsers, so that you local cache does not skew testing.


    Rick
    Universal

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

    Cash Bonus (15 February 2018)

  6. #4
    MJM
    MJM is offline Private Member
    Join Date
    November 2010
    Posts
    961
    Thanks
    189
    Thanked 550 Times in 318 Posts

    Default

    The code I was going to use if going that route is this:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^olddomain.com [NC,OR] RewriteCond %{HTTP_HOST} ^www.olddomain.com [NC] RewriteRule ^(.*)$ https://newdomain.com/$1 [L,R=301,NC]

  7. #5
    MJM
    MJM is offline Private Member
    Join Date
    November 2010
    Posts
    961
    Thanks
    189
    Thanked 550 Times in 318 Posts

    Default

    Thanks for the helpful link, I don't get the difference between "full website redirection" and running "two domains side by side" as they both stay live so as to host the htaccess file on the old domain.

  8. #6
    universal4's Avatar
    universal4 is online now Forum Administrator
    Join Date
    July 2003
    Location
    Courage is being scared to death...and saddling up anyway. John Wayne
    Posts
    33,991
    Thanks
    4,543
    Thanked 9,297 Times in 5,981 Posts

    Default

    I am not sure you need the "old domain" part....since the htaccess file should only be on the old site.
    Code:
    RewriteEngine On
    RewriteBase /
    RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L]
    The ^ takes care of (in simple terms) all requests and the $ makes page names the variable that is carried through

    and the /$1 appends said variable to the new domain during redirection.

    I may not have explained that exactly right, but is sorta what takes place.

    Rick
    Universal4

  9. The Following User Says Thank You to universal4 For This Useful Post:

    Cash Bonus (15 February 2018)

  10. #7
    MJM
    MJM is offline Private Member
    Join Date
    November 2010
    Posts
    961
    Thanks
    189
    Thanked 550 Times in 318 Posts

    Default

    So if I'm reading you write the entire htaccess file would essentially look like this (on wordpress). Also does it matter if I include www or not? I do use www as preferred version currently.
    Code:
    RewriteEngine On
    RewriteBase /
    RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L]
    
    
    # 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]
    </IfModule>
    
    
    # END WordPress
    AddHandler application/x-httpd-php70 .php .php5 .php4 .php3

  11. #8
    universal4's Avatar
    universal4 is online now Forum Administrator
    Join Date
    July 2003
    Location
    Courage is being scared to death...and saddling up anyway. John Wayne
    Posts
    33,991
    Thanks
    4,543
    Thanked 9,297 Times in 5,981 Posts

    Default

    Not sure that is enough, I think this is the correct example for wordpress

    Code:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{HTTP_HOST} !.*YOURDOMAIN\.com$ [NC]
    RewriteRule ^(.*)$ http://YOURDOMAIN.com/$1 [R=301,L]
    
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    Rick
    Universal4

  12. The Following User Says Thank You to universal4 For This Useful Post:

    Cash Bonus (15 February 2018)

  13. #9
    universal4's Avatar
    universal4 is online now Forum Administrator
    Join Date
    July 2003
    Location
    Courage is being scared to death...and saddling up anyway. John Wayne
    Posts
    33,991
    Thanks
    4,543
    Thanked 9,297 Times in 5,981 Posts

    Default

    If you are using https, then in the example you would have to adjust the 1st rewrite condition.

    Rick
    Universal4

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

    Cash Bonus (15 February 2018)

  15. #10
    MJM
    MJM is offline Private Member
    Join Date
    November 2010
    Posts
    961
    Thanks
    189
    Thanked 550 Times in 318 Posts

    Default

    Assuming this is the right way to go and not a lengthy and time consuming process requiring page by page redirects, I think I'm good to go. Redirect is in place and working, thanks for the assist on this!

  16. #11
    universal4's Avatar
    universal4 is online now Forum Administrator
    Join Date
    July 2003
    Location
    Courage is being scared to death...and saddling up anyway. John Wayne
    Posts
    33,991
    Thanks
    4,543
    Thanked 9,297 Times in 5,981 Posts

    Default

    Glad to have helped,

    See my pm, and happy to help you test , but usually after a few successful tests you likely have it fine.....if anything goes into a sub folder (like visit links etc) it wouldn't hurt to test a few.

    Rick
    Universal4

  17. The Following User Says Thank You to universal4 For This Useful Post:

    Cash Bonus (15 February 2018)

  18. #12
    MJM
    MJM is offline Private Member
    Join Date
    November 2010
    Posts
    961
    Thanks
    189
    Thanked 550 Times in 318 Posts

    Default

    I'm actually having a hard time with the google change of address tool, keeps failing to verify even though it shows in my accounts as verified. Never encountered that before, so I added and verified both versions http and www (formerly was just www) and that didn't cut it. Not https yet. I'm wondering do I need to add redirects to both www and non www versions in that htaccess file? I'm thinking google wmt says yes.

  19. #13
    universal4's Avatar
    universal4 is online now Forum Administrator
    Join Date
    July 2003
    Location
    Courage is being scared to death...and saddling up anyway. John Wayne
    Posts
    33,991
    Thanks
    4,543
    Thanked 9,297 Times in 5,981 Posts

    Default

    I have had a few sites do that also with www and non www.

    I cant see this as being a big problem, but not sure why sometimes the verification doesn't seem to work as intended (something in their algo seems to treat the sites separately - and some it doesn't do it)

    Rick
    Universal4

  20. The Following User Says Thank You to universal4 For This Useful Post:

    Cash Bonus (15 February 2018)

Posting Permissions

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