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

XF 1.1 Redirects to folder

Discussion in 'Installation, Upgrade, and Import Support' started by zooki, Apr 2, 2013.

  1. zooki

    zooki Active Member

    Hi, I moved my site over successfully from Vbulletin! -

    It used to be in a folder /forum - after I did migration to Xenforo I placed everything in the root, and made redirects. It has been around three weeks since that.

    So, right now Xenforo is in the root and I want to move my website back into a folder: /community

    I want to use the root for my CMS.

    How can I redirect to the folder, whilst also keeping the old vb redirects? Do I need one htaccess in the root? what do i keep in the folder that will hold xenforo?

    #    Mod_security can interfere with uploading of content such as attachments. If you
    #    cannot attach files, remove the "#" from the lines below.
    <IfModule mod_security.c>
        SecFilterEngine Off
        SecFilterScanPOST Off
    ErrorDocument 401 default
    ErrorDocument 403 default
    ErrorDocument 404 default
    ErrorDocument 500 default
    php_value file_uploads on
    php_value upload_max_filesize 35971520
    php_value post_max_size 35971520
    php_value max_input_time 1000
    php_value memory_limit 64M
    php_value max_execution_time 1000
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /
        #    If you are having problems with the rewrite rules, remove the "#" from the
        #    line that begins "RewriteBase" below. You will also have to change the path
        #    of the rewrite to reflect the path to your XenForo installation.
        #RewriteBase /xenforo
        #    This line may be needed to enable WebDAV editing with PHP as a CGI.
        #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
        RewriteRule ^forum/(.*)$ http://mywebsite.com/$1 [R=301,L]
        RewriteCond %{REQUEST_FILENAME} -f [OR]
        RewriteCond %{REQUEST_FILENAME} -l [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule ^.*$ - [NC,L]
        RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
        RewriteRule ^.*$ index.php [NC,L]
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Presumably you used the rewrite to change directories. Then then redirect scripts were in the root?

    Rewrite rules are not necessary here. Just upload the redirect scripts to the old /forum directory (where vB was), and edit the 301config.php file to specify the server path to the XF directory. It will handle the change of directory.

    Then you just move the XF files from the root to /community and update the board URL:

    Admin CP -> Home -> Options -> Basic Board Information -> Board URL
  3. zooki

    zooki Active Member

    The rewrites were for my old vbulletin threads -

    I am guessing that I need the rewrites for the updated xenforo URLs - because this will be my second url change.
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Oh good point.

    Then in addition to what I posted before, you can include rewrites in the root to redirect select XF URLs:

    RewriteRule ^(threads|forums|members)/(.*)$ /community/$1/$2 [R=301,L]
    Specify all XF routes you want to redirect to /community
    RoldanLT likes this.
  5. zooki

    zooki Active Member

    thank you,

    In the /community folder, should there also be a htaccess file?

    Also, should i close my forum before I move the files into another folder?
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Just XF's default .htaccess file. Nothing to do with redirects.

    Not necessary.
    zooki likes this.
  7. RoldanLT

    RoldanLT Well-Known Member

    Can I have a Nginx equivalent for this @Jake Bunce ? Thanks!
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

            location ~* ^(threads|forums|members)/.*$ {
                    rewrite (threads|forums|members)/(.*)$
    /community/$1/$2 permanent;
    That should do it.
    RoldanLT likes this.
  9. RoldanLT

    RoldanLT Well-Known Member

    Thanks Jake, but not working :|

    Redirect doesn't happen.

Share This Page