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

XF 1.2 Move from VB4 + VBSEO + Apache to XF 1.2 + Nginx

DRaver

Active member
#1
I have seen instructions from VB4 with vBSEO to migrate to XF .
But all the instructions were written with rules for Apache.

I need a tutorial for Nginx. Can anyone help me?
 

Slavik

XenForo moderator
Staff member
#2
When you've done the import, put a request up with an example of an old URL and a new URL and one of our resident regex experts will be able to write you up some rewrite rules.
 

DRaver

Active member
#3
It should take the URLs 1:1.

I copied the files from "standard-basic-advanced" to the root, than adjusted 301config.php and entered the following rewrite rule in my nginx-forum.conf file:

Code:
 location / {
        try_files $uri $uri/ /index.php?$uri&$args;
    rewrite [^/]+/([\d]+)-.+-([\d]+).html /showthread.php?t=$1&page=$2 break;
  rewrite [^/]+/([\d]+)-.+.html /showthread.php?t=$1 break;
  
    }
If I then enter an old URL into the browser an HTML file downloaded with the following content:

Code:
setupAutoloader($fileDir . '/library'); XenForo_Application::initialize($fileDir . '/library', $fileDir); XenForo_Application::set('page_start_time', $startTime); $http = new Zend_Controller_Request_Http(); $inputHandler = new XenForo_Input($http); $input = $inputHandler->filter(array( 't' => XenForo_Input::UINT, 'p' => XenForo_Input::UINT )); if(preg_match('/(?:showthread|printthread)\.php(?:\/|\?)([0-9]+)(?:-[^\/]+)/', $http->getRequestUri(), $matches) && count($matches) >= 1){ $input['t'] = intval($matches[1]); } $importModel = XenForo_Model::create('XenForo_Model_Import'); $target = false; if ($input['t']) { if ($newId = $importModel->mapThreadId($input['t'])) { $target = XenForo_Link::buildPublicLink('canonical:threads', array('thread_id' => $newId)); } } else if ($input['p']) { $newId = $importModel->mapPostId($input['p']); if ($newId) { $target = XenForo_Link::buildPublicLink('canonical:posts', array('post_id' => $newId)); } } if (!$target) { $target = XenForo_Link::buildPublicLink('canonical:index'); } $response = new Zend_Controller_Response_Http(); $response->setRedirect(XenForo_Link::convertUriToAbsoluteUri($target), 301); $response->sendResponse();
 

Jeremy

Well-known member
#5
You posted last than 4 hours ago, we cannot answer questions 24/7. It appears as if its still being read as a .html file versus being run as a PHP file. Someone more experienced with Nginx and redirects will need to help you.