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

XF 1.3 Redirect Attachments from vBulletin 4.2 User Albums

Discussion in 'Installation, Upgrade, and Import Support' started by StonePilot, May 27, 2014.

  1. StonePilot

    StonePilot Member

    So I've got just about all of my redirects complete and working properly. There is one issue that I can't get figured out. The attachments were imported into the xf database properly, just as long as an image was added to a thread/post as an attachment.

    However, I have thousands of embedded images on my vb 4.2 website where the source file is a User Album attachment. I have moved these into a photo gallery system, but can anyone help me understand how I can make a split-personality 301 redirect for attachments? Regular attachments are redirecting just fine, but not the user album images.

    vB 4.2 Site (Image is embedded in Thread): www.website.com/forum/picture.php?albumid=1050&pictureid=6321
    vB 4.2 Site (URL redirect to this when loaded in browser): www.website.com/forum/attachment.php?attachmentid=11459
    XenForo Site (Photo is stored here just fine): www.website.com/xf/gallery/photos/photo-caption-name.11459/

    Last edited: May 28, 2014
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I can help you with this. But to be certain about this redirect I need FTP access. Send me a PM.
  3. StonePilot

    StonePilot Member

    Sending you a PM.
  4. Heffalump

    Heffalump Member

    Hello Jake,

    I have the same problem after migration from vB4 to XF. Can you help me, too?
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I don't think I ever got access to his site to do these redirects.

    Please provide an example old and new URL for the content you want redirected.
  6. Heffalump

    Heffalump Member

    The old URL = domain.com/forum/album.php?albumid=619
    The new XMG URL = domain.com/forum/galerie/albums/stauraumnutzung-in-meiner-kueche-seit-12-2011.619/

    The embed pictures from old vB-albums have this url: domain.com/forum/attachment.php?attachmentid=111931&thumb=1
    The new embed url must be like this: domain.com/forum/galerie/kueche-grundriss.111931/full?d=1402111467

    It would be very nice if you find out a possibility to redirect this old urls.

    Thank you very much

  7. Mr Lucky

    Mr Lucky Well-Known Member

    The query string means a regular 301 redirect will not work.

    But this should do (given that .htaccess is in the /forum/folder):

    RewriteCond   %{REQUEST_URI}    ^/album.php$
    RewriteCond   %{QUERY_STRING}   ^albumid=619$
    RewriteRule   ^(.*)$ http://domain.com/forum/galerie/albums/stauraumnutzung-in-meiner-kueche-seit-12-2011.619/   [R=301,L]
    RewriteCond   %{REQUEST_URI}    ^/attachment.php.php$
    RewriteCond   %{QUERY_STRING}   ^attachmentid=111931&thumb=1$
    RewriteRule   ^(.*)$ http://domain.com/forum/galerie/kueche-grundriss.111931/full?d=1402111467   [R=301,L]
  8. Chris D

    Chris D XenForo Developer Staff Member

    That would redirect those single URLs... I think Heffalump is after something a little bit more dynamic than that.
  9. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Add these rules to the top of the .htaccess file in your /forum directory:

    RewriteEngine On
    RewriteCond %{QUERY_STRING} (^|\?)albumid=([0-9]+)($|&)
    RewriteRule ^album\.php$ /forum/galerie/albums/%2/? [R=301,L]
    That will take care of the first URL.

    The second one might not be appropriate to blanket redirect as it looks like a regular attachment URL from vB, but surely not all attachments are gallery images...
  10. Heffalump

    Heffalump Member

    Thank you so much, Jake.

    That redirect works like a charme. (y)
  11. Heffalump

    Heffalump Member

    There are some problems with embeded pictures vom vB4 with vbseo urls like this:


    Is it possible to rewrite this to the following url?


    The text in bold letters is the attachment.id

    Thanks again

  12. ehd

    ehd Active Member

  13. Heffalump

    Heffalump Member

    Thanks ehd,

    that works. (y)
  14. ehd

    ehd Active Member

    Worked for me, too :D

Share This Page