XF 1.2 Redirect vbseo attachments?

Andre Daub

Member
vBulletin:

domain.tld/attachments/suche-verkaufe/16620d1313950457-adidas-f50-adizero-prime-sg-anodized-purple-infrared-electricity-sam_1172.jpg

XF:

domain.tld/forum/attachments/next-gen-adizero-jpg.22482/

Ho can i redirect the vbulletin links to the new XF Attachements?
 

Mike

XenForo developer
Staff member
Is that the same attachment? I'm guessing that the old attachment was 16620, though I'm not 100% positive. If so, there are no redirect scripts for attachments so it's not trivial (that would have to be written).
 

Andre Daub

Member
Thank you. No it is not the same attachment. I have only the old Url and i have picked a random URL from the new Attachments Structure.
 

rellek

Well-known member
FYI: We managed it to work. Required this Rewrite:
Code:
RewriteRule ^attachments/(.+)/([0-9]+)[d-](.+)$ attachment.php?attachmentid=$2 [L]
and the redirection scripts in the root of the domain. 301config.php was adjusted to point to the new XF location (in /forum) and that made old attachment links work.

Additionally, we had to insert
PHP:
$config['enableClickjackingProtection'] = false;
into library/config.php so that Google Image Search works (more precisely: loading the associated page to a matched image).
 

rellek

Well-known member
Yeah, I was surprised too. Didn't have this in my first XF forum which was imported to XF 1.1. So it must have been added quite recently.
 

Brent W

Well-known member
FYI: We managed it to work. Required this Rewrite:
Code:
RewriteRule ^attachments/(.+)/([0-9]+)[d-](.+)$ attachment.php?attachmentid=$2 [L]
and the redirection scripts in the root of the domain. 301config.php was adjusted to point to the new XF location (in /forum) and that made old attachment links work.

Additionally, we had to insert
PHP:
$config['enableClickjackingProtection'] = false;
into library/config.php so that Google Image Search works (more precisely: loading the associated page to a matched image).
What about this url: http://www.v6mustang.com/vb/attachments/f7/72506d1121305572-dpfe-sensor-dpfe-sensor.jpg

in Nginx?

attachment.php resides in /vb/ folder.

I have tried this but it doesn't work:

Code:
rewrite ^/vb/attachments/(.+)/([0-9]+)[d-](.+)$ /vb/attachment.php?attachmentid=$2 last;
 

Brent W

Well-known member
Tried this as well, with no luck:

Code:
rewrite ^/vb/attachments/f([\d]+)/([0-9]+)[d-](.+)$ /vb/attachment.php?attachmentid=$2 last;
 

Brent W

Well-known member
I got this to work with the following rewrite:

Code:
rewrite ^/vb/attachments/[^/]+/([0-9]+)d.+$ /index.php?attachments/$1/ permanent;
and by editing staticfiles.conf in nginx to remove the jpg extension.
 

DRaver

Active member
I need an NGINX rewrite for attachments.

Code:
From:
http://www.my-domain.de/attachments/alte-fotowettbewerbe-hunde/61955d1389003298-hund-jahre-2013-hund-mai.jpg

to
http://www.my-domain.de/attachments/hund-mai-jpg.61955/
 

Jake Bunce

XenForo moderator
Staff member
@DRaver

Try this:

Code:
        location ~* ^/attachments/[^/]+/[0-9]+d[0-9]+-[^\./]+\..*$ {
                rewrite [^/]+/([0-9]+)d[0-9]+-[^\./]+\..*
/attachments/$1/ last;
        }
 
Top