XF 1.3 Moving Site to Root

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
 
Yes, it still applies.

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

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)?
 
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.
 
@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>
 
@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]
 
You will need to have a valid .htaccess file in the root.
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>
 
Also, do I leave the .htaccess in the community file?

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.
 
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.

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>
 
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>

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)
 
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:
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>
not sure if it is me but, I am now getting 404 error on every link...
 
Top Bottom