Move Forum To New Domain While Keeping URL Structure

Davey-UK

Active member
I've done a lot of searching to find an answswr to this, but with no definitive answer from what i can see.
My situation:
My forum is currently in the forums subdirectory on abc.com. Example abc.com/forums
The threads and posts urls have the format of
Code:
https://abc.com/forums/threads/is-this-still-normal.12345/#post-17890123

I am wanting to move the forums to a completely new domain, still in a /forums sub directory, but on a different server.
We have a very good ranking on google, and wouldnt want to drop too many ranks because of the move if possible.

If i were to leave the old domain on the old server and place a htaccess redirect in there, can anyone tell me if it is possible to keep the thread/post format in the url structure when redirecting to the new domain, so as not to break the sequence.
For example
Code:
https://newdomain.com/forums/threads/is-this-still-normal.12345/#post-17890123
Any help on the htaccess code required would be greatly appreciated.
Thanks
 
If only the domain is changing then you would just do a catch all 301 redirect from the old domain to the new domain.
Thanks for such a swift reply. So the following code should do the trick, and redirect the old domain links directly to the same thread on the new domain?
Code:
RewriteEngine on

RewriteCond %{HTTP_HOST} ^abc.com [NC,OR]

RewriteCond %{HTTP_HOST} ^www.abc.com [NC]

RewriteRule ^(.*)$ https://newdomain.com/$1 [L, R=301,NC]

Thanks again
 
Just an update on this one, and please help if anyone has an answer
I have put the following in the root of my old domain, which is forwarding correctly to newdomain.com/forums
BUT, when clicking on old links from the old domain in Google search, they only go to the same /forums and not to the actual post in the search listings.
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.oldomain\.com$
RewriteRule (.*)$ https://newdomain.com/forums [R=301,L]

Now if i use the following code example, the Google links work perfectly, BUT obviously the /forums redirection is now taken out, where that is where i need it to redirect if someone simply types olddomain.com in the address bar and not from a google link.
Is there any way of combining the two?
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.oldomain\.com$
RewriteRule (.*)$ https://newdomain.com [R=301,L]

If anyone could help in the slightest it would be very much appreciated.
 
You're missing the /$1 from your saturday example post which appends the full path from the clicked URL to the new URL. You should also keep the NC flag so it's case insensitive.
 
Top Bottom