Viktor Levytskyi Posted October 12, 2020 Posted October 12, 2020 Hi guys, After migrating from vb4 everything works fine except redirecting from existing blogs and articles. Vbulletin was installed to mysite.com/forum, but blog and articles located outside "/forum" (this is a standard VBulletin feature). VB4: forum - mysite.com/forum, blog - mysite.com/blog, articles - mysite.com In the database I found tables: convert_apps, convert_app_sessions, convert_bbcode_mediatag, convert_custom_bbcode, convert_link_pms, convert_link, convert_link_posts, convert_link_topics, convert_logs I don't see any information about matching old and new blogs and articles... where can I find this information? Obviously, we have some redirect rules, where are these rules located?
Stuart Silvester Posted October 12, 2020 Posted October 12, 2020 Hi Victor, Our converter will already redirect vB Blog /entries/x URLs, all you would need to do is make sure those requests are redirected into your Invision Community platform i.e redirect yourdomain.com/blogs/entries/x-title to yourdomain.com/forums/entries/0-title our converter will automatically see this and redirect the request from there. We don't redirect article paths because they can greatly differ from one vB install to another and may clash with our own Pages URLs. The redirect rules are in the converter PHP files themselves /applications/converter/sources/Software/Blog/Vbulletin.php -> checkRedirects() Thanks! Stuart Viktor Levytskyi 1
CoffeeCake Posted October 12, 2020 Posted October 12, 2020 3 hours ago, Viktor Levytskyi said: Obviously, we have some redirect rules, where are these rules located? If you had redirect rules in vBulletin that were not the default URL paths, then the trick is to redirect from your old URL scheme back to what the out of the box vBulletin path would have been. For example, we had a custom solution in place that would change our forum thread URLs to things like example.com/forums/forum-name/thread-name-1234/. As part of our migration to IPS, we redirect that style of URL to what the original vBulletin URL would have been: example.com/forums/showthread.php?t=1234. This then gets redirected by the IPS handler to the correct migrated thread. Viktor Levytskyi 1
Viktor Levytskyi Posted October 13, 2020 Author Posted October 13, 2020 Thanks guys for the comments. Here are the results of my experiments: Current Blog location: http://yourdomain.com/blog/entry.php?b=1136 - redirect does not work Ok, I moved blogs to default location http://yourdomain.com/forum/entry.php?b=1136 and migrated data again - redirect does not work I tried manually modify url http://yourdomain.com/forum/entries/1136 - redirect works fine! So, If I understand correctly, Migrator expects to see "entries/1136" instead of "entry.php?b=1136" 16 hours ago, Stuart Silvester said: The redirect rules are in the converter PHP files themselves /applications/converter/sources/Software/Blog/Vbulletin.php -> checkRedirects() In this file I see code if( preg_match( '#/entries/([0-9]+)#i', $url->data[ \IPS\Http\Url::COMPONENT_PATH ], $matches ) ) I can try to modify this code but will be good to keep the "core" functionality unchanged in order to avoid problems in future updates.
CoffeeCake Posted October 13, 2020 Posted October 13, 2020 (edited) 44 minutes ago, Viktor Levytskyi said: I can try to modify this code but will be good to keep the "core" functionality unchanged in order to avoid problems in future updates. Don't do that. 🙂 That will become a nightmare to maintain over time. Instead, leverage rewrites on your web server to take your vBulletin blog paths and redirect them to what IPS is expecting. So, in your case, create a permanent redirect from /blog/entry.php?b=XXXX to /entries/XXXX. This will then get rewritten internally by the IPS handler to the new location. Any old links to blog/entry.php will still work and end up at the correct place and you don't need to modify/maintain any code. Behind the scenes, you'll have two redirects happening automatically: blog/entry.php?b=1234 -> /entries/1234 -> /blog/whatever-the-new-ips-blog-url-is-5678 Edited October 13, 2020 by Paul E. Stuart Silvester and Viktor Levytskyi 2
Solution CoffeeCake Posted October 13, 2020 Solution Posted October 13, 2020 (edited) Just adding an (completely untested, good luck, YMMV) nginx and apache example to get you going. Apache: RewriteCond %{QUERY_STRING} b=([0-9]+) [NC] RewriteRule ^/blog/entry.php$ /entries/%1? [R=301,L] Nginx: if ($request_uri ~ ^/blog/entry\.php\?b=([0-9]+)) { return 301 /entries/$1; } Edited October 13, 2020 by Paul E. Correct apache version.
Viktor Levytskyi Posted October 13, 2020 Author Posted October 13, 2020 Apache: RewriteCond %{QUERY_STRING} b=([0-9]+) [NC] RewriteRule ^/blog/entry.php$ /entries/%1? [R=301,L] I fixed a tiny mistake in the RewriteRule: /entries/$1? => /entries/%1? Works fine. Paul, thank you very much.
CoffeeCake Posted October 13, 2020 Posted October 13, 2020 33 minutes ago, Viktor Levytskyi said: I fixed a tiny mistake in the RewriteRule: /entries/$1? => /entries/%1? Oops! 😁 Apologies, but we're an nginx shop. Glad it got you there! I've edited my original post for future time travelers. Viktor Levytskyi 1
Viktor Levytskyi Posted October 21, 2020 Author Posted October 21, 2020 The Google Search Console displays an address like "/entries/1111" Perhaps the Google Crawler saw a redirect to "/ entries" and added that page to the index? 🤕
CoffeeCake Posted October 21, 2020 Posted October 21, 2020 2 hours ago, Viktor Levytskyi said: The Google Search Console displays an address like "/entries/1111" Perhaps the Google Crawler saw a redirect to "/ entries" and added that page to the index? 🤕 I would think these are permanent (301) redirects, which should tell Google and other search engines "the new permanent address is over yonder." IPB can you confirm? https://support.google.com/webmasters/answer/93633
Stuart Silvester Posted October 21, 2020 Posted October 21, 2020 2 hours ago, Paul E. said: I would think these are permanent (301) redirects, which should tell Google and other search engines "the new permanent address is over yonder." IPB can you confirm? https://support.google.com/webmasters/answer/93633 Yes we use a '301' redirect by default.
Recommended Posts