• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.1 Importing a part of xenForo to a whole new forum (xenForo)

faeronsayn

Well-known member
#1
How hard is it to import let's say a section of your current xenForo forum to a whole new xenForo forum? And only import users that have posts from that forum? Also would it be easy to redirect the URLs?
 

Brogan

XenForo moderator
Staff member
#3
There is currently no direct XenForo to XenForo importer.

You will need to go via other software such as phpBB, IPB or vB, assuming they have a XenForo importer.
 

CallieJo

Active member
#5
I am currently doing something similar...splitting up parts of a forum into their own stand-alone forums.

Right now I have a test forum that I am cleaning up. It contains all content and members. I plan on copying the database over to each new forum and deleting whatever I won't need for each particular forum. A lot of work, but it seems like the easiest route in my case.

Good luck!
 

faeronsayn

Well-known member
#6
I am currently doing something similar...splitting up parts of a forum into their own stand-alone forums.

Right now I have a test forum that I am cleaning up. It contains all content and members. I plan on copying the database over to each new forum and deleting whatever I won't need for each particular forum. A lot of work, but it seems like the easiest route in my case.

Good luck!
How are you planning on forwarding the URLs?
 

CallieJo

Active member
#7
Sorry, I don't have a solution for forwarding urls from just specific categories. It's pretty easy to forward "all" urls from one setup to another. But, I don't believe there is a way to forward only urls belonging to specific categories to another setup unless you had the category names in the thread urls. I could be wrong. Maybe a developer can help answer that question.

For myself, I'm not worried about urls since I will be linking to the new forums anyways from the old one and I'm not concerned with backlinks and SE's and all that. I know it will all work itself out eventually.

Hope you find the solutions you want.
 

faeronsayn

Well-known member
#11
Then you can use similar queries to update the id maps for imported forums. The process is the same though.
I don't really have access to an IPB license at the moment.

I was able to use the same database and delete all the forums I didn't need. Now i'd just need to redirect the threads that I didn't delete. Since the IDs of these threads remained the same, the URL redirection might be pretty simple?
 

Jake Bunce

XenForo moderator
Staff member
#12
It's unclear to me exactly what process you are using. But for the purpose of redirects I need specific examples of before and after links.
 

faeronsayn

Well-known member
#13
It's unclear to me exactly what process you are using. But for the purpose of redirects I need specific examples of before and after links.
This is what I am doing.

Forum A has lets say 5 sections.

I create Forum B on a new domain, and I want one of those 5 sections imported to forum B.

So I use Forum A's database with Forum B. This new Forum B's database hold all of Forum A's content, but I delete the 4 other sections and leave one. At the end, I have 1 section in Forum B and 5 sections in Forum A.

Now the section that I moved from Forum A to Forum B, needs to have all of it's threads inside it redirect to Forum B.

The before and after URLs would be like

example.com/threads/thread-name.id/

example2.com/threads/thread-name.id/

The url structure and IDs won't actually change, it's just the domain name will change.

What I am having difficulty with is to redirect only the threads within the section that I imported to forum b, not all threads.

I was thinking maybe if it was possible to get all the thread IDs of the threads that were imported then use something like this link

example.com/threads/thread-id/ <--- and redirect that.

In any case, you'd probably have the answer to that.
 

Jake Bunce

XenForo moderator
Staff member
#14
That will be difficult to do "nicely". You will need to check the node_id for every thread before redirecting, and the node_id is not in the URL. You would have to get into the PHP code to do the check.

I was thinking maybe if it was possible to get all the thread IDs of the threads that were imported
An exhaustive list of thread_ids would be an alternative to checking the node_id. How many threads total?
 

faeronsayn

Well-known member
#15
That will be difficult to do "nicely". You will need to check the node_id for every thread before redirecting, and the node_id is not in the URL. You would have to get into the PHP code to do the check.



An exhaustive list of thread_ids would be an alternative to checking the node_id. How many threads total?
Looking at a couple thousand.

I could probably query the database to get the thread_ids i'd assume? But throwing those in there with simple 301 redirects in the .htaccess file, I don't know if that'll work.

With the php code, we'd probably have to run that code on each thread url, I am really not sure which way to go about it.
 

Jake Bunce

XenForo moderator
Staff member
#16
Example of redirect with explicit list of threadids:

Code:
RewriteRule ^threads/[^\.]+\.(1|2|3|4|5|6|7|8|9)/(.*)$ http://www.example2.com/threads/$1/$2 [R=301,L]
 

faeronsayn

Well-known member
#17
Example of redirect with explicit list of threadids:

Code:
RewriteRule ^threads/[^\.]+\.(1|2|3|4|5|6|7|8|9)/(.*)$ http://www.example2.com/threads/$1/$2 [R=301,L]
Is there a way to output all thread id's in that manner? I mean in this format : 1|2|3|4|5|6|7|8|9

If there are about a few thousand listed like this, would this cause any problems?
 

Jake Bunce

XenForo moderator
Staff member
#18
Is there a way to output all thread id's in that manner?
You can export a list of thread_ids using phpmyadmin. Run this query using phpmyadmin:

Code:
SELECT thread_id
FROM xf_thread
WHERE node_id IN (1,2,3);
If you want to save the results then click Export at the bottom of the page in phpmyadmin after you run the query. It will give you lots of format options. I would probably export it as an Excel or CSV and then import into Excel. Then use some Excel functions to concatenate a list together. This requires some dexterity.
 

faeronsayn

Well-known member
#19
Example of redirect with explicit list of threadids:

Code:
RewriteRule ^threads/[^\.]+\.(1|2|3|4|5|6|7|8|9)/(.*)$ http://www.example2.com/threads/$1/$2 [R=301,L]

I tried the above code, and it didn't work for some reason.

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
 
#If you are having problems with the rewrite rules, remove the "#" from the
#line that begins "RewriteBase" below. You will also have to change the path
#of the rewrite to reflect the path to your XenForo installation.
#RewriteBase /xenforo
 
#This line may be needed to enable WebDAV editing with PHP as a CGI.
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
 
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(data/|js/|styles/|install/|favicon\.ico) - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
RewriteRule ^threads/[^\.]+\.(37976|24569)/(.*)$ http://www.mynewdomain.com/threads/$1/$2 [R=301,L]
</IfModule>