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

XF 1.3 Moving Site to Root

Discussion in 'XenForo Questions and Support' started by wickedstangs, May 26, 2014.

  1. wickedstangs

    wickedstangs Well-Known Member

    Does the below still Apply for moving to Root?

    How can I move my installation to a different directory?

    Update the Board URL in the ACP -> Options -> Basic Board Information and move the files to the new directory (or rename the directory). You may need to restart the server for the change to take effect.
    Note that redirection will be required to ensure any existing links continue to work.
    For example, if the installation is moved from the /community directory to the root, the following line needs to be added to the .htaccess file, after the default XenForo rewrite rules:

    Code:
    RewriteRule ^community/(.*)?$ /$1 [R=301,L]

    Keep getting bad remarks due to my redirect....

    Overview
    Because redirects trigger an additional HTTP request-response cycle and add extra round-trip-time latency, it's important to minimize the number of redirects issued by your application. Avoiding HTTP redirects can reduce the amount of time a user waits for a page to load. We encourage you to consider your site design carefully to see where you can improve your site performance.

    Here are some examples of good and bad redirect patterns:

    • Great: example.com uses responsive web design, no redirects are needed
    • Ok: example.com -> m.example.com/home
    • Bad: example.com -> www.example.com -> m.example.com -> m.example.com/home
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Yes, it still applies.

    The rewrite is required if you want links for existing indexed content (e.g. Google searches) to continue to work.
     
    wickedstangs likes this.
  3. wickedstangs

    wickedstangs Well-Known Member

    what would be the best way to do the move?

    Download all files and put them in root, then change it in ACP and .htaccess if everything is working fine then delete the original directory (url.com/community)?
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    You can just move them on the server directly, either using an FTP application or file manager in cPanel.

    Then update .htaccess and change the Board URL in the ACP.
     
  5. wickedstangs

    wickedstangs Well-Known Member

    @Brogan where do I put the code at?
    RewriteRule ^community/(.*)?$ /$1 [R=301,L]

    Code:
    #    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
    #</IfModule>
    
    ErrorDocument 401 default
    ErrorDocument 403 default
    ErrorDocument 404 default
    ErrorDocument 500 default
    
    <IfModule mod_rewrite.c>
        RewriteEngine On
    
        #    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}]
    
        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]
    </IfModule>
     
  6. wickedstangs

    wickedstangs Well-Known Member

    getting lots of errors:(
    err.JPG

    how do I restart the server?
     
  7. Brogan

    Brogan XenForo Moderator Staff Member

     
  8. wickedstangs

    wickedstangs Well-Known Member

    there is a htaccess.txt with the above stuff and a htaccess. with nothing in it?
     
  9. wickedstangs

    wickedstangs Well-Known Member

    @Brogan ok found this in the community directory

    Code:
    Rlimitnproc 30
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    
    RewriteCond %{HTTP_HOST} ^wickedstangs\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.wickedstangs\.com$
    RewriteRule ^/?$ "http\:\/\/wickedstangs\.com\/community\/" [R=301,L]
    RewriteRule ^community/(.*)?$ /$1 [R=301,L]
     
  10. Brogan

    Brogan XenForo Moderator Staff Member

    You will need to have a valid .htaccess file in the root.
     
  11. wickedstangs

    wickedstangs Well-Known Member

    Ok, I think I got it now.. I deleted my .htaccess file and uploaded a new one..

    This is what I have and it seems to work now. Is the below correct?

    Code:
    #    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
    #</IfModule>
    
    ErrorDocument 401 default
    ErrorDocument 403 default
    ErrorDocument 404 default
    ErrorDocument 500 default
    
    <IfModule mod_rewrite.c>
        RewriteEngine On
    
        #    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}]
    
        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]
        RewriteRule ^community/(.*)?$ /$1 [R=301,L]
    </IfModule>
     
  12. Brogan

    Brogan XenForo Moderator Staff Member

    Yes, that looks fine, as long as it's all working as expected.
     
    wickedstangs likes this.
  13. wickedstangs

    wickedstangs Well-Known Member

    @Brogan I am not sure if its my computer cache but, I am getting lots of 404 Not Found on google searches

    What exactly is that rewrite saying?
    RewriteRule ^community/(.*)?$ /$1 [R=301,L]

    I moved my site from www.wickedstangs.com/community ---> to www.wickedstangs.com


    Also, do I leave the .htaccess in the community file?
     
  14. wickedstangs

    wickedstangs Well-Known Member

    Anything else I have to do to fix my .htaccess?
     
  15. nodle

    nodle Well-Known Member

    I think it needs to be in the root on the site. I just check mine and my rewrite rule is like this:

    Code:
    RewriteCond %{HTTP_HOST} ^yoursite\.com [NC]
    RewriteRule ^(.*)$ http://www.yoursite.com/$1 [R=301,L]
    This allows my non .www to be directed to my .www (you can change this the other way if need be).

    So ya I think since you changed from community that needs to be removed.
     
    wickedstangs likes this.
  16. wickedstangs

    wickedstangs Well-Known Member

    how is this now and thank you..
    Code:
    #    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
    #</IfModule>
    
    ErrorDocument 401 default
    ErrorDocument 403 default
    ErrorDocument 404 default
    ErrorDocument 500 default
    
    <IfModule mod_rewrite.c>
        RewriteEngine On
    
        #    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}]
    
        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]
        RewriteCond %{HTTP_HOST} ^wickedstangs\.com [NC]
        RewriteRule ^(.*)$ http://www.wickedstangs.com/$1 [R=301,L]
    </IfModule>
     
  17. nodle

    nodle Well-Known Member

    I have mine at the beginning of my .htaccess file. But I don't know if it really matters. So ya I think you are good to go.(y)
     
    wickedstangs likes this.
  18. nodle

    nodle Well-Known Member

    Thought I would update this. I thought I would let you know that I had to move my redirects up top I tried in the same spot as you but it wouldn't re-direct my non www to my www. So I thought I would let you know. May want to check yours if that's how you like it. Or test it.

    Another words like:

    Code:
    #    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
    #</IfModule>
    
    ErrorDocument 401 default
    ErrorDocument 403 default
    ErrorDocument 404 default
    ErrorDocument 500 default
    
    <IfModule mod_rewrite.c>
        RewriteEngine On
    
        RewriteCond %{HTTP_HOST} ^wickedstangs\.com [NC]
        RewriteRule ^(.*)$ http://www.wickedstangs.com/$1 [R=301,L]
    
        #    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}]
      
        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]
    </IfModule>
    
    
     
    Last edited: Jun 10, 2014
    wickedstangs likes this.
  19. wickedstangs

    wickedstangs Well-Known Member

    not sure if it is me but, I am now getting 404 error on every link...
     
  20. nodle

    nodle Well-Known Member

    I can hit your main site just fine but any link after that is a 404. You didn't mess with routes or anything originally did you?
     

Share This Page