XenForo Redirects for vBulletin

XenForo Redirects for vBulletin 1.1.9

No permission to download
Forum updated to 2.0.4, addon to 1.1.1. Option is populated with table name. Sadly we're still getting "404 Not Found" when old vBulletin4 url is used.

Old URL: https://<fqdn>/showthread.php/17359-threadtitle
New URL: https://<fqdn>/threads/threadtitle.17359/

Our host server runs nginx 1.12.2 ... Did anyone figured out what is missing to make it work?

Thank you in advance!
This addon seems to work only with Apache
 
This addon seems to work only with Apache

The problem is the friendly-URL nginx code snippet shown in the manual:
Code:
location /xf/ {
    try_files $uri $uri/ /xf/index.php?$uri&$args;
    index index.php index.html;
}

location /xf/install/data/ {
    internal;
}
location /xf/install/templates/ {
    internal;
}
location /xf/internal_data/ {
    internal;
}
location /xf/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;
}

The problematic part is the try_files in the php-location. It serves as a security precaution to only send existing .php-files to the backend. But in our redirection-scenario files like showthread.php do not exist...

The remedy is to also redirect to index.php in this section like this:

Code:
try_files $uri /xf/index.php?$uri&$args;

This is safe because XF's route controller will check the passed arguments and XF301VB routes accordingly.


HTH,
-Markus
 
Hey.

(Shortened my former question a bit. :))
Is there a way to get the url redirect to work when the URLs had been created by specific rules from the vBSEO addon? Thanks in advance for your help.
 
Last edited:
certain characters in thread titles break the redirect, at least on nginx.

"!" "()" and "*" are examples I've discovered so far.
 
Last edited:
I've installed this addon, and modified my site's nginx config, as @markus68 suggested above, but it's not working on my forum. In chrome it returns a HTTP 500 error. I've configured the addon to look at archived_import_log (which is apparently where the info resides, from the original switch in 2014).

I was hoping someone had some other suggestions I could try.
 
The "500" is probably not coming from nginx but from the XF backend/addon. Anything in the server error log ?
 
The "500" is probably not coming from nginx but from the XF backend/addon. Anything in the server error log ?

There are a bunch of errors on the XF ‘server error log’ page, but they don’t appear to be related to this addon.

If I try to click through one of the errors on the Google Webmasters page, it’s not generating any errors in The XF admin panel.
 
Well,
clear the error-log, try again and if something shows up in the log, post it here (or if you are under support open a ticket as the redirect addon is an official one).
 
I made a little progress in understanding why it's not working: in the nginx server error logs, I'm seeing a reference to the old (physical) file location, whereas the new one is different. What's confusing is that it's been in the current location for at least 2 years.

2018/06/08 20:46:50 [error] 14698#0: *91528 FastCGI sent in stderr: "PHP message: PHP Warning: require(/home/wackbag/xen/library/XenForo/Autoloader.php): failed to open stream: No such file or directory in /home/wb-nfs/wackbag/xen/showthread.php on line 11
PHP message: PHP Fatal error: require(): Failed opening required '/home/wackbag/xen/library/XenForo/Autoloader.php' (include_path='.:/usr/share/pear7:/usr/share/php7') in /home/wb-nfs/wackbag/xen/showthread.php on line 11" while reading response header from upstream, client: 192.168.6.89, server: www. .com, request: "GET /showthread.php?p=3228301 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www. .com"


Relevant locations are:
old:
/home/wackbag/xen

new:
/home/wb-nfs/wackbag/xen

How do the showthread, showpost, and other vB files get their file location? The $fileDir is set to $fileDir = dirname(__FILE__);.

If I explicitly define the location to the correct place; $fileDir = '/home/wb-nfs/wackbag/xen';, it still fails to redirect, and gives the same error.
 
It looks like the nginx-redirect is wrong, because it still looks for showthread.php where that should have been rewritten to index.php.

Can you post the relevant location sections from your nginx config ?
 
It looks like the nginx-redirect is wrong, because it still looks for showthread.php where that should have been rewritten to index.php.

Can you post the relevant location sections from your nginx config ?

Here's the site's conf file:
Code:
# Send http non-www to https www.
    server {
    listen 80;
    server_name wackbag.com;
    return 301 https://www.wackbag.com$request_uri;
    server_tokens off;

    }

# Answer www. requests

    server {
        listen    80;
        # ELB stores the protocol used between the client
        # and the load balancer in the X-Forwarded-Proto request header.
        # Check for 'https' and redirect if not
        #if ($http_x_forwarded_proto != 'https') {
        #        return 301 https://$host$request_uri;
        #        }
        server_name    www.wackbag.com;

    if ($http_x_forwarded_proto != 'https') {
        rewrite ^(.*)$ https://$server_name$1 permanent;
    }

        index    index.html index.php;
        root    /home/wb-nfs/wackbag/xen;
        access_log    /var/log/wackbag/access.log;
        error_log    /var/log/wackbag/error.log;
        server_tokens off;

    location / {
        root    /home/wb-nfs/wackbag/xen;
        try_files $uri $uri/ /index.php?$uri&$args;
        }
        
    location /install/data/ {
        internal;
        }
        
    location /install/templates/ {
        internal;
        }
        
    location /internal_data/ {
        internal;
        }
        
    location /library/ {
        internal;
        }

    location /src/ {
        internal;
        }

    location ~ /admin\.php$ {
        auth_basic "Restricted Area";
        auth_basic_user_file /xxxxx;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include fastcgi_params;
        }

    location ~ \.php$ {
        try_files $uri $uri/ /index.php?$uri&$args;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_read_timeout 300;
        include fastcgi_params;
        }

    }
 
Glad it worked. If you have other VB.php like archive.php, they can all be removed. All this stuff is handled via the index.php, the XF-router and the addon itself.
 
One more thing:

In the try_files line
Code:
    location ~ \.php$ {
        try_files $uri $uri/ /index.php?$uri&$args;
        fastcgi_pass   127.0.0.1:9000;
the $uri/ should not be needed. Does not hurt, but this would be enough:
Code:
    location ~ \.php$ {
        try_files $uri /index.php?$uri&$args;
        fastcgi_pass   127.0.0.1:9000;
 
Dummy here. :giggle:

I changed from VB4 to XF1 three years ago and used add on:
vB4 URL Redirection 0.0.2
Which is still installed.

When I upgrade from XF1 to XF 2 what should I do if anything? Do I need this or another redirect add on? Or does upgrading from XF1 to XF2 take care of everything?
 
Hello, everyone. My forum is at www.phuot.vn
I've just moved to XF2 from vB4. vB4 originally installed in root directory, and XF2 in /congdong. So www.phuot.vn went to the old vB4 forum and www.phuot.vn/congdong went to the new XF2 forum with the imported database.

I then installed XenForo redirects for vBulletin add-on ver 1.1.1:
- selecting the import_log table,
- following the manual to copy the .htaccess and index.php files from src/addons/XF301VB/SourceLocation/ to the root folder, where vB4 originally installed, after editing the $dir in the index.php to $dir = '/home/myname/public_html/congdong';

But the links were not redirected and following the link www.phuot.vn let me to a page with text only (thread title...) without any graphics.

I then moved all the vB4 files/folders to a new folder named /saved_vbulletin, then moved XF2 files/folders to the root directory. So my new XF2 forum can be accessed at www.phuot.vn now.

However, all the old links aren't redirected, still.

For instance, this is a link resulted from a Google search Bali site:phuot.vn: https://www.phuot.vn/threads/340115-Indo-không-chỉ-có-bali
Clicking on the link will give us a "The requested page could not be found.", while it should be redirected to https://www.phuot.vn/threads/indo-không-chỉ-có-bali.340115/

Could you help me fix it?

Thank you very much in advance!
 
I also have a problem with the attachments as all the images attached to the posts in vB4 forum are not shown when the forums have been converted to XF2. The attachment link is still in the old form like: https://www.phuot.vn/attachment.php?attachmentid=146187.

Please help me. I'm now in the dark!
 
Top Bottom