XF 1.2 Rewrite rule after moving Xenforo to root

Martok

Well-known member
#1
I'm looking at moving my installation to the root. It is currently in /community/.

I know how to do the move and the change in the ACP. What I'm not sure on is the rewrite rules I need so that anyone who uses an old URL with /community/ in it will end up at the correct location.

Sorry if this has been asked before but I couldn't find the answer.
 

Liam W

Well-known member
#2
I'm looking at moving my installation to the root. It is currently in /community/.

I know how to do the move and the change in the ACP. What I'm not sure on is the rewrite rules I need so that anyone who uses an old URL with /community/ in it will end up at the correct location.

Sorry if this has been asked before but I couldn't find the answer.
Offhand, this seems to work:

Code:
RewriteRule community$ / [R=301]
RewriteRule community/(.*)$ $1 [R=301]
Add that just under the first <ifmodule mod_rewrite> tag :)
 

Jake Bunce

XenForo moderator
Staff member
#3
Add to the top of the .htaccess file in the old /community directory:

Code:
RewriteEngine On

RewriteRule ^(.*)$ /$1 [R=301,L]
Or if you wish to delete the old directory then add this to the top of the .htaccess in the web root:

Code:
RewriteEngine On

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