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

XF 1.2 Rewrite rule after moving Xenforo to root

Discussion in 'XenForo Questions and Support' started by Martok, Sep 15, 2013.

  1. Martok

    Martok Well-Known Member

    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.
     
  2. Liam W

    Liam W Well-Known Member

    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 :)
     
    Martok likes this.
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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]
    
     
    Martok likes this.
  4. Martok

    Martok Well-Known Member

    Thank you. :D
     
  5. Liam W

    Liam W Well-Known Member

    Hey, mine worked as well, I think... ;)
     
    Last edited: Sep 15, 2013

Share This Page