XF 2.3 Moving my XF forum from subdomain to a new domain

KhanTastic

Active member
Dear friends,

My forum is on my first old domain ( abc.com/forum ) but now I purchased a new domain and hosting it on the same hosting/ server.

So the forum I want to move to my new domain (xyz.com), I moved all my files from old domain to this new domain but the problem is I do not understand how my forum threads/posts url will redirect to the new domain?

Right now when I access my new domain it says Error 500 - Internal Server Error and there is no way to debug the XF. I tried to search posts here before making these posts but looks like most of those posts are outdated as the files/ folders structure has been changed here, even these old posts here say the config file is under library folder but its not, its now under src folder.

And the debug codes are not config file anymore.

Therefore I am opening this thread, please someone guide me, how I can debug my new site to find our the error, also do I need to move the database also? Because its still the same hosting, I do not think I need to move database, and there is no domain URL in config file, so I have no idea what I should update inside the XF files.

All I want my forum from abc.com/forum to the new domain xyz.com

I hope someone will help me if understood my question. :)

Many thanks in advance,

Cheers
 
so, this is a bit complicated to resolve without having access to the project itself. first, you would need to fix the new install. database might still need to be moved depending upon what kind of hosting you have. if it is the same hosting account, it should work but you should check with your host.

you are right that you cannot change the forum link in config file. it is configured from forum admin panel. and you should be able to open admin panel even if you are not on the currently configured domain. that's how i setup my test install after replicating the folder structure and database.

Error 500 - Internal Server Error here could be for a lot of things. See if you can open the xyz.com/install link...
 
so, this is a bit complicated to resolve without having access to the project itself. first, you would need to fix the new install. database might still need to be moved depending upon what kind of hosting you have. if it is the same hosting account, it should work but you should check with your host.

you are right that you cannot change the forum link in config file. it is configured from forum admin panel. and you should be able to open admin panel even if you are not on the currently configured domain. that's how i setup my test install after replicating the folder structure and database.

Error 500 - Internal Server Error here could be for a lot of things. See if you can open the xyz.com/install link...
Thanks your reply, yes it looks really difficult and not straight forward as I thought :(

My hosting is the same, only I purchased a new domain for my forum so that I can move my forum from old subdomain. Now I am trying everything I can, I downloaded the forum database and then manually edited links inside ( abc.com/forum ) and replaced with my new domain (yxz.com) and then uploaded the database back on my hosting. But the problem is I still see Error 500 - Internal Server Error and there is no way I can debug the forum to find out the issues.

I manually added the below codes in my config.php file and still my site does not show the errors:-

// Debug Mode
$config['debug'] = true;

I am still trying, hopefully I will find a way to fix it. But will keep an eye here, maybe someone will be able to help.
 
oh wow, I made it finally lolzzzz
Now my forum is working perfect and moved to the new domain from old subdomain.

Just to let you know how I did , in case someone goes through the same in future, then this post might help them.

First download all files from old domain and the complete database file.

Then via FTP or cPanel, upload all the forum files to the new domain, then open that downloaded database file in an editor, and make changes in the database & password lines if you created a new database for your new domain. And make sure all the links (old domain) inside the database, you replace them with the new domain, save the database file and then import it via phpmyadmin from cPanel to the newly created database user.

Then you are done!
This is how it worked for me :)

Cheers
 
What about re-directs ?
I did not do any re-directs and did not touch the .htaccess file at all.

Maybe its because my hosting is still the same, only I purchased new domain ( xyz.com) and then moved my forum from my other (abd.com/forum) domain to this new ( xyz.com) domain. I did not do anything for re-directs and I can see all my posts/ threads work perfect on my new domain :)
 
I would suggest doing a redirect from old domain to new domain using something like this if you are using apache.


If you are dumping the old domain and moving to new domain permanently, it would be a good idea to set up Google Search Console to tell Google that you have moved over to the new domain from the old one.

Change of Address Tool - Search Console Help
 
I would suggest doing a redirect from old domain to new domain using something like this if you are using apache.


If you are dumping the old domain and moving to new domain permanently, it would be a good idea to set up Google Search Console to tell Google that you have moved over to the new domain from the old one.

Change of Address Tool - Search Console Help

I did not want to re-direct because I am deleting the /forum subdomain.

I have pet blogs website at main domain abc.com then I hosted a pet related forum on abc.com/forum
Now I purchased a new domain (xyz.com) , so I moved my forum from that subdomain abc.com/forum to the new domain (xyz.com) domain.

I will follow your suggest about google search console thing, let's see how it goes :)
Thank you for the reply, much appreciated and I hope it will help others too in the future.

Cheers
 
ooo. do not use google search console as you still are using the first domain as the blog. google search console change of address tool is only to be used when you are completely discarding an old domain and moving to new.

but do setup redirects from /forum folder on old domain to new domain so that all existing links pointing to old location redirect to new location. you can still delete the /forum folder as redirect rule does not require the folder to actually exist.
 
ooo. do not use google search console as you still are using the first domain as the blog. google search console change of address tool is only to be used when you are completely discarding an old domain and moving to new.

but do setup redirects from /forum folder on old domain to new domain so that all existing links pointing to old location redirect to new location. you can still delete the /forum folder as redirect rule does not require the folder to actually exist.

Oh now I understand why you said re-direct that /forum folder to my new domain, yes you are right my forum posts are maybe in google and if people click on that, there will be no forum. You are so right. Thank you so much for making me understand that and also noted about Google Search Console :)

Thank you once again, you saved me <3
 
and also of course, update the domain for your xenforo license in customer area!

Yes, I did that, thanks a lot,
right now I am struggling with the re-directs you mentioned to me

https://stackoverflow.com/questions/11715684/htaccess-redirect-folder-to-a-url/60272009#60272009

is this the code right?

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/somedir [NC]
RewriteRule /(.*) http://somesite.com/lost/$1 [R=301,L]


I tried to replace /somedir with /forum
and replaced with my new domain
But still does not redirect. I am still battling with that :)
 
where did you put the code? it should be added to .htaccess file on first domain base folder. this would only work if you are on apache. i haven't used apache in a while but code seems accurate to me so it should work.

if you have cpanel, it might have an internal option making things easier.

 
Last edited:
where did you put the code? it should be added to .htaccess file on first domain base folder. this would only work if you are on apache. i haven't used apache in a while but code seems accurate to me so it should work.

if you have cpanel, it might have an internal option making things easier.


I am using InMotion Hosting and I put those codes in that /forum directory inside the .htaccess file. Did I make the replacement correctly as I mentioned in the above post?
 
.htaccess file does not work inside folders. you have to put it in the base folder. assuming you have wordpress blog there, it should already exist there and just needs to be edited with this additional lines.
 
.htaccess file does not work inside folders. you have to put it in the base folder. assuming you have wordpress blog there, it should already exist there and just needs to be edited with this additional lines.

Oh I see, so .htaccess file does not work only inside the folder! Thanks for that information.
Yes I have wordpress site on main domain, that has .htaccess file, let me try to add these lines there and I Will update you how it goes.

Thank you once again @Chromaniac

Editing:-

Yes it worked when I added it in the main root .htaccess file :)

Thanks a lot, I learned from you this i never knew!
Much appreciate, have a lovely day/evening ahead!
 
you are right that you cannot change the forum link in config file.
Actually, you can:

PHP:
 $c->extend('options', function(\ArrayObject $options)
{
    $options->boardUrl = 'https://localhost/xf';
    $options->boardUrlCanonical = false;
    return $options;
});

However, as you also stated, you should always be able to manually enter site.com/admin.php to access it.
 
Actually, you can:

PHP:
 $c->extend('options', function(\ArrayObject $options)
{
    $options->boardUrl = 'https://localhost/xf';
    $options->boardUrlCanonical = false;
    return $options;
});

However, as you also stated, you should always be able to manually enter site.com/admin.php to access it.
Thank you for the information, its helpful and I will keep in mind in case needed in future.
For now, I think I am all set, my forum is successfully loading on the new domain :)
 
Top Bottom