You will need python, which can be downloaded here:
Open up IDLE (Python GUI). Click File/New Window and copy and paste the scripts.
1. Extract all of your original thread links from the sitemap. Take note of if your threads are listed chronologically or reverse chronologically.
This is something I put together in python (with a lot of googling and learning!) to extract the links from XML sitemaps. It worked for me but you may have to modify it a bit to work for you.
If you do decide to use it, fill in your domain, sitemap location, and path for the saved .txt file under the commented sections.
#!/usr/bin/env python import re # your website domain, keep the format domain="http://www.yoursitehere.com" # path of the sitemap, locally stored path = "C:\Downloads\sitemap.xml" # path and file name of resulting text file path2 = "D:\Wherever\Old Forum URLs.txt" fileHandle = open(path, "r") sitemap = fileHandle.read() fileHandle.close() replaced = sitemap.replace("<loc>"+domain, "redirect 301 ") list = re.findall("redirect 301.*</loc>", replaced) fileHandle = open(path2, "w") for item in list: final = item.replace("</loc>","\n") fileHandle.write(final) fileHandle.close() print "Completed. Results have been saved to", path2
2. After you have all your old thread URLs, you need the new ones. For this, we can take advantage of the fact that in Xenforo, as long as the thread ID is correct you'll get redirected to the correct thread.
You need to know the total number of threads on your forum.
You could manually go to ...threads/whatever.1/
Copy the redirected link and then go to ...threads/whatever.2/
And so on...
That works fine or a small board, in fact that's what I did it for 100/467 threads. I only came up with a quicker way to do this during my long break at school (yes, with python).
Fill in the relevant sections, they're commented in the code. If your sitemap lists threads in reverse chronological order, the code is fine as it is.
If your sitemap is chronological:
Replace for thread in reversed(range(1, totalthreads+1)): with for thread in range(1, totalthreads+1):
#!/usr/bin/env python import urllib2 # path to your xenforo threads directory xenpath = "http://127.0.0.1/webdav/xenforo/index.php?threads/" # total number of threads on your forum totalthreads = 467 # path to save the resulting text file savepath = "D:/Wherever/New Forum URLs.txt" filehandle = open(savepath, "w") for thread in reversed(range(1, totalthreads+1)): link = xenpath+"a.%s/" % thread response = urllib2.urlopen(link) url = response.geturl() filehandle.write(url+"\n") filehandle.close() print "Completed. Results have been saved to", savepath
3. Now you have 2 text files with links that should match line by line. Open up a spreadsheet in excel. Paste the original links into the first column and the new links into the second column. Now copy and paste both columns and paste them into Notepad++ or another editor. Fix the spacing so that it'll work in .htaccess file.