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

Redirects not working

Discussion in 'Installation, Upgrade, and Import Support' started by mistypants, Mar 6, 2013.

  1. mistypants

    mistypants Well-Known Member

    Hi all,

    We moved our site ( http://www.kh-vids.net/ ) to XenForo in August of 2012. I set up redirects back then and they were all working fine. Recently we had a small hack (nothing major or related to XF, they deleted a few files, everything's been locked down since), and our redirects broke (they deleted the redirect files). I've been trying to fix it no avail.

    I've reuploaded everything from here: http://xenforo.com/community/resources/vbulletin-4-x-url-redirection.120/
    And updated 301config.php as described here.

    Still, old URLs are just redirecting to the homepage. :( Any ideas?

    For the record, here's some old links:
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Confirm the name of the import log table in the database. It's usually named xf_import_log or archived_import_log. Then specify that name in the 301config.php file. If the table name is incorrect then it will result in all redirects going to the forum index.
  3. Dodgeboard

    Dodgeboard Well-Known Member

    Did you add your rewrite rules to your .htaccess file?

    Paste the contents of your .htaccess file into a post.
  4. mistypants

    mistypants Well-Known Member

    Doh, that was it! I added the name of the table but I forgot to uncomment the line.

    Thanks a lot.
  5. novice

    novice Member

    Hi Jake ... would you mind helping me with the same?

    My redirects have been working fine, but they're redirecting to my home page now. I don't see any reason why things changed. I've confirmed the above and all is well. Any suggestions on how I can get them to work properly again?

    Thanks in advance.
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I need FTP access to your server to confirm the table name and check the 301config.php file. You can PM me.
    novice and Dodgeboard like this.
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The old thread links are using the vB2 format:


    You will notice that it works if you use this:


    I have modified the showthread.php file to check for 'threadid' as well:

    $startTime = microtime(true);
    $fileDir = dirname(__FILE__);
    if (file_exists($fileDir . '/301config.php'))
    	include($fileDir . '/301config.php');
    require($fileDir . '/library/XenForo/Autoloader.php');
    XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');
    XenForo_Application::initialize($fileDir . '/library', $fileDir);
    XenForo_Application::set('page_start_time', $startTime);
    $inputHandler = new XenForo_Input(new Zend_Controller_Request_Http());
    $input = $inputHandler->filter(array(
    	't' => XenForo_Input::UINT,
    	'p' => XenForo_Input::UINT,
    	'threadid' => XenForo_Input::UINT
    $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['threadid'])
    	if ($newId = $importModel->mapThreadId($input['threadid']))
    		$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);
    It works now.
    novice likes this.
  8. novice

    novice Member

    Thank You Jake ... You're The Best!

Share This Page