• 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

#1
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/

Thoughts?
 
Last edited:
#6
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

Michael
 

Mr Lucky

Well-known member
#7
The query string means a regular 301 redirect will not work.

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

Code:
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]
Code:
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]
 

Chris D

XenForo developer
Staff member
#8
That would redirect those single URLs... I think Heffalump is after something a little bit more dynamic than that.
 

Jake Bunce

XenForo moderator
Staff member
#9
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

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

Code:
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...
 
#11
There are some problems with embeded pictures vom vB4 with vbseo urls like this:

domain.com/forum/attachments/kuechenplanung-im-planungs-board/132179d1391724761-dimslukens-traumkueche-alno_2d_uebersicht_v2.png

Is it possible to rewrite this to the following url?

domain.com/forum/attachments/alno_2d_uebersicht_v2-png.132179/

The text in bold letters is the attachment.id

Thanks again

Michael