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

XF 1.5 SMF Pretty URLs

#2
I don't think it will import the addon itself, but it should save the paths of the url's as they are. Then just enable the option in Xenforo to continue with enabling full friendly url's.
 

Brogan

XenForo moderator
Staff member
#3
The importer will only handle core content.

Anything related to add-ons will be ignored.

Having said that, I would be surprised if the add-on actually changes anything in the database.
It is likely just going to be rewrite rules.
 

Mike

XenForo developer
Staff member
#6
Referring to the rewrite rules for the SMF, they aren't auto generated. But if you post before and afters, they may be createable (provided there are IDs in the URLs).
 
#7
Seamless redirects are a major requirement of a forum migration. It's important for existing hyperlinks out there as well as SEO.

-----

Here are the rewrite rules the Pretty URLs SMF mod added to the old folder's htaccess:

Code:
# PRETTYURLS MOD BEGINS
# Pretty URLs mod
# http://code.google.com/p/prettyurls/
# .htaccess file generated automatically on: July 27, 2011, 0:14

RewriteEngine on
RewriteBase /discuss

# Rules for: actions
RewriteRule ^(activate|admin|announce|attachapprove|buddy|calendar|clock|collapse)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(coppa|credits|deletemsg|display|dlattach|editpoll|editpoll2|emailuser)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(findmember|groups|help|helpadmin|im|jseditor|jsmodify|jsoption)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(lock|lockvoting|login|login2|logout|markasread|mergetopics|mlist)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(moderate|modifycat|modifykarma|movetopic|movetopic2|notify|notifyboard|openidreturn)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(pm|post|post2|printpage|profile|quotefast|quickmod|quickmod2)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(recent|register|register2|reminder|removepoll|removetopic2|reporttm|requestmembers)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(restoretopic|search|search2|sendtopic|smstats|suggest|spellcheck|splittopics)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(stats|sticky|theme|trackip|about:mozilla|about:unknown|unread|unreadreplies)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(verificationcode|viewprofile|vote|viewquery|viewsmfile|who|\.xml|xmlhttp)/?$ ./index.php?pretty;action=$1 [L,QSA]

# Rules for: boards
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1.0 [L,QSA]
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([0-9]*)/?$ ./index.php?pretty;board=$1.$2 [L,QSA]

# Rules for: topics
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1;topic=$2.0 [L,QSA]
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/([0-9]*|msg[0-9]*|new)/?$ ./index.php?pretty;board=$1;topic=$2.$3 [L,QSA]

# PRETTYURLS MOD ENDS
Since there is a set schema for SMF, and a set schema for Xenforo, I was hoping this would be in place as part of the importer.

I don't think this is comprehensive, but here is the requested list of before (SMF) and after (XF) URLs for some different page types (how do i insert a table?)

Board /discuss/main-bhangra-discussion/ /testXF/index.php?forums/main-bhangra-discussion.1/
Board /discuss/off-topic/ /testXF/index.php?forums/off-topic.4/
Thread /discuss/off-topic/rootsgear-is-now-offering-custom-bomber-jackets/ /testXF/index.php?threads/rootsgear-is-now-offering-custom-bomber-jackets.28402/
Post /discuss/off-topic/rootsgear-is-now-offering-custom-bomber-jackets/msg241350/#msg241350 /testXF/index.php?threads/rootsgear-is-now-offering-custom-bomber-jackets.28402/#post-241350
Thread /discuss/post-mixes-and-video-links/buckeye-bhangra-bhangra-in-the-burgh-10/ /testXF/index.php?threads/buckeye-bhangra-bhangra-in-the-burgh-10-aaj-ka-dhamaka.28385/
Post /discuss/post-mixes-and-video-links/buckeye-bhangra-bhangra-in-the-burgh-10/msg241367/?topicseen#msg241367 /testXF/index.php?threads/buckeye-bhangra-bhangra-in-the-burgh-10-aaj-ka-dhamaka.28385/#post-241367
Post /discuss/main-bhangra-discussion/**anakh-sherniyan-di-tashan-and-bab-2016-videos**/msg241362/?topicseen#msg241362 /testXF/index.php?threads/anakh-sherniyan-di-tashan-and-bab-2016-videos.28329/#post-241362
Thread /discuss/main-bhangra-discussion/'what-happened-to-bhangra'/ /testXF/index.php?threads/what-happened-to-bhangra.28373/
Page 2 /discuss/main-bhangra-discussion/'what-happened-to-bhangra'/20/ /testXF/index.php?threads/what-happened-to-bhangra.28373/page-2
Page 3 /discuss/main-bhangra-discussion/costume-tips-tricks/40/ /testXF/index.php?threads/costume-tips-tricks.640/page-3
Page 30 /discuss/main-bhangra-discussion/new-member-introduce-yourself-here!/580/ /testXF/index.php?threads/new-member-introduce-yourself-here.183/page-30
Home /discuss/index.php /testXF/index.php
 
#8
I also have a table in the SMF DB with topic IDs and their 'pretty URL' basis. note that there are parentheses and other special characters in there. Google has the pretty URL

Code:
"28319","tarey-panj-daryavan-de-(t52d)-bab5-2016"
"28320","buckeye-akd-please-do-not-post"
"28321","reign-of-bhangra-late-deadline-is-approaching!"
"28322","smd-bab-please-do-not-post"
"28323","jacquizz-rogers"
"28324","cmu-got-bhangra-please-do-not-post!"
"28325","uva-di-shaan-big-apple-bhangra-2016-please-dont-post"
"28326","dcmpaa-bab-2016-do-not-post"
"28327","**buckeye-mela-x-final-reminder**"
"28328","tesher-make-bhangra-great-again"
"28329","**anakh-sherniyan-di-tashan-and-bab-2016-videos**"
"28330","joshiley-jawan-akd-2016-(do-not-post)"
"28331","gator-bhangra-big-apple-bhangra-2016-do-not-post"
"28332","got-bhangra-competition-2016-feedback-and-placings"
"28333","**bhangra-in-the-burgh-2016-predictions**"
"28334","spartan-bhangra-at-got-bhangra-2016-please-do-not-post"
"28335","soormay-bhangra-in-the-6ix"
"28336","big-apple-bhangra-5-placings"
"28337","aaj-ka-dhamaka-2016-feedback-and-placings"
"28338","bhangra-fever-vii-application"
"28339","soormay-bhangra-in-the-6ix-28339"
"28340","boston-bhangra-competition-2016-performance-videos"
"28341","boston-bhangra-competition-2016-predictions"
"28342","sixth-annual-nach-ke-dikha-bhangra-and-fusion-competition"
"28343","soormay-bhangra-in-the-6ix-mix"
"28344","harbour-city-bhangra-2017-express-your-interest!"
"28345","end-this-years-ladder"
"28346","big-10-bhangra-competition-application-deadline-extended!"
"28347","bhangra-fever-vii-judging-application"
"28348","tarey-panj-daryavan-de-(t52d)-tryouts"
"28349","circle-city-bhangra-competition-***-judges-application-released-***"
"28350","ndc2017-final-application-deadline!"
"28351","looking-to-buy-saaps"
"28352","bhangra-down-under-2016-team-mixer-(highlights)"
"28353","ultimate-team-hopper"
"28354","teri-khair-mangdi-slambassador-remix-out-now"
"28355","crossroads-of-bhangra-competition-2017-***applications-released***"
"28356","big-10-bhangra-competition-judges-reveal"
"28357","need-paghs-tied-for-a-performance-in-tampa-fl"
"28358","join-a-bhangra-team-in-vancouver-or-surrey"
"28359","motor-city-bhangra-juniors-and-giddha-competition-2017!!"
"28360","team-intros-judges-at-the-mixer-(bdu-2016)"
"28361","****folk-vibez-dhol-loops-now-on-sale****"
"28362","west-coast-bhangra-2017-exhibition-registration"
"28363","folk-soundz-ft-surinder-shinda-ghukkar-di-maut-(out-12-01-16)"
"28364","registration-deadline-for-all-collegiate-and-independent-teams-aa-dekhen-zara"
"28365","aeg-bhangra-in-the-burgh-x"
"28366","furteelay-bbc-(do-not-post)"
"28367","fcb-bib-x-do-not-post"
"28368","boston-bhangra-2016-results-and-reviews"
"28369","unc-bib-x-(please-do-not-post)"
"28370","dholi-needed-in-seattle!"
"28371","98349835-jvd-boston-bhangra-2016-mix-98349835"
"28372","alamo-city-bhangra-(girls)-bbc-2016"
"28373","what-happened-to-bhangra"
"28374","re-what-happened-to-bhangra"
"28375","circle-city-bhangra-competition-***-2-week-reminder-team-applications-***"
"28376","re-what-happened-to-bhangra-28376"
"28377","west-cost-bhangra-surprise-revealed"
"28378","join-a-bhangra-team-in-castro-valley-ca-(bay-area)"
"28379","re-boston-bhangra-2016-results-and-reviews"
"28380","re-boston-bhangra-2016-results-and-reviews-28380"
"28381","what-happened-to-bhangra-(umerqureshi96-content-removed)"
"28382","reaching-out-to-all-**current**-dancerscaptains"
"28383","unc-bhangra-elite-bibx"
"28384","crossroads-of-bhangra-competition-2017-**-new-website!**"
"28385","buckeye-bhangra-bhangra-in-the-burgh-10"
"28386","black-beatles-bhangra-(dhol-mix)-by-rae-singh-sremmurd-ft-gucci-mann"
"28387","bhangra-on-the-rocks-competition-in-mile-high-city-denver-co-*registration-open"
"28388","**reign-of-bhangra-2017-official-lineup**"
"28389","what-are-yall-thankful-for"
"28390","dhulla-remix-kuldeep-manak-jazzy-b"
"28391","bhangra-state-of-mind-iv-registration-packet-28391"
"28392","bhangra-fever-vii-application-now-open!!!"
"28393","new-mix-harjit-harman-x-mickey-singh-(dj-harj-matharu)"
"28394","bhangra-is-being-ruined"
"28395","arabic-beat-name"
"28396","circle-city-bhangra-competition-2017-***-exhibition-applications-released-***"
"28397","current-captains-please-message-me"
"28398","official-mob-chicago-mix-burgh-bhangra-in-the-6ix"
"28399","mob-chicago-bhangra-in-the-six-bhangra-in-the-burgh-x"
"28400","interested-in-judging-for-naach-di-cleveland-2017"
"28401","*new*-bhangra-banger-sample!-(prod-inaiksbeats)"
"28402","rootsgear-is-now-offering-custom-bomber-jackets"
"28403","nachde-nashville-applications"
"28404","fever-vii-regular-application-deadline-extended!"
"28405","crossroads-of-bhangra-competition-2017-***-judges-application-released!***"
 
#10
@Jake Bunce thanks for the reply and link, very helpful. I posted a snippet of that table, above. It needs a bit more work because the SMF URLs include which board it is on. I need to do a join with another SMF table. I'll take a deeper look and see if i can get all the SMF data in one clean output.
 
#11
Hi @Jake Bunce, please see below if this will be helpful to you. I really appreciate your help.

I’ve exported all the topic info from SMF: board ID #, topic ID #, and topic Slug. I can then map the 10 board IDs to the board Slug in the original URI. So I'm table to take just the Topic's ID number and redirect it to [new forum URL]/threads/number

e.g. source URL
to
which expands/redirects automatically to
I can't paste a table here, even with bbcode it seems and I can't upload an excel file I'll paste some info below. Among the 28,000 topics I have, some are problematic as there are apostrophes in the URL, which I could not preserve in the export from the database to csv. E.g. : http://bhangrateamsforum.com/discus...-well-run-competition-a-dancer's-perspective/ my CSV would mess up because it thinks the original URL is
bhangrateamsforum.com/discuss/main-bhangra-discussion/crafting-a-well-run-competition-a-dancers-perspective

Thoughts on this error? How do I make this operational when I do the forum migration and need redirects? Do I need 28,000 lines in an htaccess file? I am in over my head. *thank you* so much for your help.

upload_2016-12-26_17-50-57.png

BoardID TopicID Title Lookup Board Name Original URL Redirect URL
1 28242 dance-ke-deewane-2016-registration /main-bhangra-discussion/ /discuss/main-bhangra-discussion/dance-ke-deewane-2016-registration /testXF/threads/28242
1 28243 looking-to-buy-hardcover-dhol-case /main-bhangra-discussion/ /discuss/main-bhangra-discussion/looking-to-buy-hardcover-dhol-case /testXF/threads/28243
 

Jake Bunce

XenForo moderator
Staff member
#14
For reference...

To redirect old SMF thread URLs that use slugs such as this URL:

http://bhangrateamsforum.com/discuss/main-bhangra-discussion/bhangra-fever-vii

1) Upload the attached file (smfthreadredir.php) to your root directory for XenForo. And edit the file to specify your forum URL:

Code:
if ($id)
{
	header ('HTTP/1.1 301 Moved Permanently');
	header ('Location: http://yoursite.com/xenforo/threads/' . $id);
}
2) Copy the smf_pretty_topic_urls table from your SMF database to your XenForo database.

3) Add these rewrite rules to the .htaccess file in your old SMF location:

Code:
# redirect smf threads to xf
RewriteEngine on
RewriteRule ^(forum-slug1|forum-slug2|forum-slug3)/(.+)$ /xenforo/smfthreadredir.php?slug=$2 [L]
To avoid possible conflicts with other SMF URLs I made it so you need to specify all of the SMF forum slugs as a pipe-delimited list. It will only try to match the thread slug if the URL starts with one of those forum slugs.

(all of this assumes your SMF and XF ids are the same)
 

Attachments

#15
Thanks for this useful information! What do I need to put at the forum-slug1/2/3 positions? Below the .htaccess.

# PRETTYURLS MOD BEGINS
# Pretty URLs mod
# http://code.google.com/p/prettyurls/
# .htaccess file generated automatically on: December 4, 2016, 21:58

RewriteEngine on
RewriteBase /

# Rules for: downloadsystem
RewriteRule ^downloads/([^/]+)/([^/]+)/([0-9]*)/?$ ./index.php?action=downloads;sa=view;down=$3 [L,QSA]

# Rules for: smfgallery
RewriteRule ^gallery/([^/]+)/([^/]+)/([0-9]*)/?$ ./index.php?action=gallery;sa=view;id=$3 [L,QSA]
RewriteRule ^gallery/([^/]+)/([^/]+)/([0-9]*)/?$ ./index.php?action=gallery;sa=view&id=$3 [L,QSA]

# Rules for: smfarticles
RewriteRule ^articles/([^/]+)/([^/]+)/([0-9]*)/?$ ./index.php?action=articles;sa=view;article=$3 [L,QSA]

# Rules for: actions
RewriteRule ^(activate|admin|articles|announce|attachapprove|buddy|calendar|clock)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(collapse|comment|coppa|credits|deletemsg|display|dlattach|editpoll)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(editpoll2|emailuser|findmember|groups|help|adpro|downloads|gallery)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(helpadmin|im|jseditor|jsmodify|jsoption|lock|lockvoting|login)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(login2|logout|markasread|mergetopics|mlist|moderate|modifycat|modifykarma)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(movetopic|movetopic2|notify|notifyboard|newspro|openidreturn|pm|post)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(post2|printpage|profile|quotefast|quickmod|quickmod2|recent|register)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(register2|reminder|removepoll|removetopic2|reporttm|requestmembers|restoretopic|search)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(search2|sendtopic|sitemap|smstats|suggest|spellcheck|splittopics|stats)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(sticky|store|theme|trackip|about:mozilla|about:unknown|unread|unreadreplies)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(verificationcode|viewprofile|vote|viewquery|viewsmfile|who|calreminder|\.xml)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(xmlhttp|form)/?$ ./index.php?pretty;action=$1 [L,QSA]

# Rules for: boards
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1.0 [L,QSA]
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([0-9]*)/?$ ./index.php?pretty;board=$1.$2 [L,QSA]

# Rules for: topics
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1;topic=$2.0 [L,QSA]
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/([0-9]*|msg[0-9]*|new)/?$ ./index.php?pretty;board=$1;topic=$2.$3 [L,QSA]

# PRETTYURLS MOD ENDS
 
#17
#20
Hello,

I'm back again ;)

How can I test this on a test Xenforo install when our "old" SMF installation is still live. I imported the SMF data into the test area and copied the Table.

Thanks for your help!

Vincent