XF 1.5 NGINX Rewrite Rules - VB3/VBSEO Link to Xenforo

ENF

Well-known member
Hi,

We recently solved a problem of getting some links passed through to XF but now that these links are making it to Xenforo, it's just tossing up a error page. (better than the 404 page we were getting before)

System is XF 1.5.13, PHP 7.0.x, NGINX 1.11.9, XF in Root
Import Log from VB3 is intact and working...
VB3 Redirects supplied by XF are in place... (for even older links before our short life with VBSEO)
301 config file is updated with the correct import lot name and home directory.

Source URL (example):
http://domaingoeshere.nnn/forum-name-here/32951-this-is-thread-title.html

Ths source URL is from our past VB3/VBSEO days and was the standard configuration. A lot of our old links are stuck in people's browsers as well as other sites that have linked to us. Essentially, we noticed a lot of lost traffic due to the shear number of these old links.

I've tried a number of different directives from some of the other NGINX threads, but no dice on getting the links to point to the right location.

I'd like to confirm:
1) The correct directive to put in the site .conf file.
2) The correct position in the .conf file (above/below XF Friendly URL settings, etc.)

I'm probably overlooking something obvious, so a fresh pair of eyes would be nice. Thanks.
 
It might be easiest if you show exactly what you have in your Nginx config. Nginx structures its config fairly differently than a .htaccess, so order may not be relevant exactly.
 
  • Like
Reactions: ENF
Mike is right... the context can be relevant. But this rule should work:

Rich (BB code):
        location ~* ^/[^/]+/[^\./]+\.html$ {
                rewrite [^/]+/([0-9]+)-[^\./]+\.html
/xfdir/showthread.php?t=$1 last;
        }
 
  • Like
Reactions: ENF
Mike is right... the context can be relevant. But this rule should work:

Rich (BB code):
        location ~* ^/[^/]+/[^\./]+\.html$ {
                rewrite [^/]+/([0-9]+)-[^\./]+\.html
/xfdir/showthread.php?t=$1 last;
        }

I could have sworn we tried this one... but it works.

Code:
location / {
        try_files $uri $uri/ /index.php?$uri&$args;
        index index.php index.html;
}

location /install/data/ {
        internal;
}
location /install/templates/ {
        internal;
}
location /internal_data/ {
        internal;
}
location /library/ {
        internal;
}

location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include         fastcgi_params;
}

location ~* ^/[^/]+/[^\./]+\.html$ {
                rewrite [^/]+/([0-9]+)-[^\./]+\.html
/showthread.php?t=$1 last;
        }

  include /usr/local/nginx/conf/503include-only.conf;
  include /usr/local/nginx/conf/block.conf;
  include /usr/local/nginx/conf/staticfiles.conf;
  include /usr/local/nginx/conf/php.conf;
  include /usr/local/nginx/conf/drop.conf;
  #include /usr/local/nginx/conf/errorpage.conf;
  include /usr/local/nginx/conf/vts_server.conf;
}

That's the final config that works...

Thanks so much!
 
Mike is right... the context can be relevant. But this rule should work:

Rich (BB code):
        location ~* ^/[^/]+/[^\./]+\.html$ {
                rewrite [^/]+/([0-9]+)-[^\./]+\.html
/xfdir/showthread.php?t=$1 last;
        }

Jake, would you help me put these rewrite rules?

Code:
RewriteRule f[\d]+/.+-([\d]+)/index([\d]+).html showthread.php?t=$1&page=$2 [NC,L]
RewriteRule f[\d]+/.+-([\d]+)/ showthread.php?t=$1 [NC,L]
RewriteRule f([\d]+)/index([\d]+).html forumdisplay.php?f=$1&page=$2 [NC,L]
RewriteRule f([\d]+)/ forumdisplay.php?f=$1 [NC,L]

I tried it a couple times but it won't work:

Code:
    location ~* ^/f[0-9]+/.+-([0-9]+)/$ 
{ 
rewrite .+-([0-9]+)$ /showthread.php?t=$1 last; 
}
    location ~* ^/f[0-9]+/$ 
{ 
rewrite f[0-9]+$ /forumdisplay.php?f=$1 last; 
}
 
Back
Top Bottom