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

XF 1.1 1 htaccess file wth 2 redirects?

Discussion in 'XenForo Questions and Support' started by snoopy5, Oct 30, 2012.

  1. snoopy5

    snoopy5 Well-Known Member


    After my import of several vbforums into 1 xf forum, I want to put now htaccess files in the old vb locations. All vbforums have a different domainname than the XF forum.

    currently it is

    RedirectPermanent / http://mydomainname.com
    The problem is that the users often save two different bookmarks for the old vbforum.

    1. www.domainname.com

    With my current redirect, I only redirekt #1. With #2 comes an error.

    How can I add in the same htaccess file another redirect for #2?
  2. melbo

    melbo Well-Known Member

  3. snoopy5

    snoopy5 Well-Known Member


    I thought these redirection scripts work only if I import onyl 1vb into 1 xf forum. But in my case, I imported 10vb forums in 1 xf forum and changed the structure of the xf forums compared to the old vb forums.

    Would these xf redirect scripts then still find the right threads?
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    These redirect scripts will work as long as you saved the import log from each import:


    At the end of each import it would have given you the option to archive the import log, thus allowing you to save logs for each import. The redirect scripts have a 301config.php file which allows you to specify the name of the import log table.

    But to answer your original question... I suggest rewrite rules. This would go into your .htaccess file in the web root, assuming the /forum directory does not exist:

    RewriteEngine On
    RewriteRule ^forum/index\.php$ http://mydomainname.com/? [R=301,L]
  5. melbo

    melbo Well-Known Member

    Yes the redirect script files are placed each of the 10 old vBulletin forum directories (if you still have access to them.)
  6. snoopy5

    snoopy5 Well-Known Member


    I have all import logs. So this should be fine. In the instructions, I found to spots where I might run into problems:

    How can I deal with this, if the XF Forum is not only in another dierctory, but also with another domainname? (on the same server). How do I need to change this then?

    Currently I have the vb forums in maintenance mode. Do I need to change this for the redirect to work?

    If I overwrite vb files, is there still a ways afterwords to have admin access via another URL to the vb forums?

    I often need still access to double check if users can not login into XF after the import and tell me their username. I check then in the vbforum for that username and solve any open questions.
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    It would be best to setup a separate redirect for the change of domain. If vB was in /forum on the old site then use this in a .htaccess file in that old /forum directory:

    Redirect 301 /forum/ http://www.newdomain.com/forum/
    Then create a /forum directory on the new domain and upload the redirect scripts to there.


    Don't delete the vB files. Then you will have access. You only need to overwrite the PHP files that have redirect scripts, like showthread.php.
  8. snoopy5

    snoopy5 Well-Known Member

    mmmhhhhhh.... does not work for me. It seems that in my constellation, I need a different directory name.

    When I do it as described above, the redirect url in the browser is then:


    but the correct url of my XF forum is:


    So this part "/forum/" seems to be wrong. But no matter what I change in the 301config.php file, this "/forum" does not go away.


    current setup:

    all on the same server

    domainname 1 with vb installed in directory 1, which is "forum". So the vb forum is accessable under


    in this /forum directory are all vb files. I copied all files of the XF redirect package into this, except the 301config.php. Additionally I put a .htaccess file into the same directory with the text:

    in the XF directory (directory2), I created a subdirectory "forum". In this one I put the 301config.php file with the code:

    /* ----------------------------------------------------------- *\
    This variable defines where XenForo is installed.
    If you have not installed XenForo into the same directory in which
    vBulletin was installed, you will need to provide the full path to
    the XenForo directory here. Remove the leading // and then enter
    the path as in the following examples:
        $fileDir = '/home/example/public_html/new_forums';
        $fileDir = 'C:/inetpub/wwwroot/xenforo';
    \* ----------------------------------------------------------- */
        $fileDir = '/mypathtonewxfforum';
    /* ----------------------------------------------------------- *\
    This constant defines the table from which the import redirection
    scripts will fetch their data. Normally they will use the table
    'xf_import_log', but if you have archived your import data, you
    should provide the name of the archive table here. Remove the
    leading // and then replace 'import_log_x' with the name of your
    archive table, as in the following examples:
        define('IMPORT_LOG_TABLE', 'my_import_log');
        define('IMPORT_LOG_TABLE', 'import_log_my_forums');
    \* ----------------------------------------------------------- */
        define('IMPORT_LOG_TABLE', 'archived_import_log_special');
    This '/mypathtonewxfforum' is the full path to the xf forum. So the directory for mydomainname2.com. This is not the mydomainname2.com/forum/ directory with the 301config.php in it

    No matter what I change in this setting, the result are always the same. I get in the browser the mydomainname2.com/forum/index.php instead of mydomainname2.com/index.php. Even if I leave the /mypathtonewxfforum/forum/ directory empty.

    Any ideas what I do wrong?

    and the second question would be: Since I have imported 10 different vb forums with 10 different log files, how do I apply these 10 at the same time in the 301config.php?
  9. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That means this setting is wrong:

    Admin CP -> Home -> Options -> Basic Board Information -> Board URL

    Remove the /forum part from this URL. The redirect scripts use this setting to build the forum links.
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You would have 10 different sets of redirect scripts at each of the original vB forum locations. Each 301config.php file would have a different import log specified.
  11. snoopy5

    snoopy5 Well-Known Member

    There is no forum part in that URL. It is only "http//mydomainname2.com"

    But as you posted earlier in this thread, with my specific constellation, I need to put the 301config.php file in a new directory "forum" in the XF directory, not the one of the vb dirctory. If I put in the xf directory 10x a 301config.php file, how does one know which file is for which vb forum, since all 10 are then in one singel forum directory?
  12. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Well in your case there are two redirects. You need to test each one separately to make sure they are working. One changes the domain, the other uses the redirect scripts to map the old URL to the new XenForo one.

    To maintain separation between the different vB domains you can setup different forum directories on the new domain that contain different sets of redirect scripts.

Share This Page