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

Moving XF to another dir

Discussion in 'Forum Management' started by Beermonster, May 31, 2014.

  1. Beermonster

    Beermonster Member

    I'm thinking of installing Wordpress and using the WP and XF bridge, I've been told XF would be better in another directory and WP in root, I'm not too good with .htaccess does anyone know what I would put in to redirect the current URL from root to example /forum/

    Or what would be the best way to redirect?

    Also are they any config details I need to change in XF when moving it?
     
  2. Martok

    Martok Well-Known Member

    Beermonster and borbole like this.
  3. Beermonster

    Beermonster Member

    Thanks, I've tried making changes to my htaccess and it doesn't seem to do anything.

    I've moved everything to a community directory, and changed the url in the admincp, this is my htaccess before changes, what and where do I need to change?

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

    # This line may be needed to enable WebDAV editing with PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteRule [^/]+/([\d]+)-.+-([\d]+).html showthread.php?t=$1&page=$2 [NC,L]
    RewriteRule [^/]+/([\d]+)-.+.html showthread.php?t=$1 [NC,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) - [NC,L]
    RewriteRule (robots\.txt)$ robots.php [NC,L]
    RewriteRule ^.*$ index.php [NC,L]


    </IfModule>
     
  4. Tracy Perry

    Tracy Perry Well-Known Member

    Try uncommenting the rewrite base directive and place /community in place of the default /.
     
  5. Beermonster

    Beermonster Member

    Thanks, I'm getting there, when someone visits from a search engine they get a 404 page, I can't get it to redirect from domain/threads/thread-title.html to domain/community/threads/thread-title.html
     
  6. Beermonster

    Beermonster Member

    Anyone have any idea how I can fix this? Google is now reporting too many 404's
     
  7. nodle

    nodle Well-Known Member

  8. Beermonster

    Beermonster Member

    Thanks, it's helped a little, I now have 2 urls that will take you to the same content, one with community in it one without.

    I don't want to have duplicate content listed, I don't know what to do with it now :(

    This is my new .htaccess,

    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.
    RewriteRule ^community/(.*)?$ /$1 [R=301,L]
    RewriteBase /community

    # This line may be needed to enable WebDAV editing with PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteRule [^/]+/([\d]+)-.+-([\d]+).html showthread.php?t=$1&page=$2 [NC,L]
    RewriteRule [^/]+/([\d]+)-.+.html showthread.php?t=$1 [NC,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]
    </IfModule>

    I also have a similar one in the community dir
     
  9. nodle

    nodle Well-Known Member


    Your not using community any more are you? Then the bolded parts above need to be changed.
     
  10. Beermonster

    Beermonster Member

  11. nodle

    nodle Well-Known Member

    Oh your not moving it to root sorry about that. Glad to see you got it working sir! :)
     

Share This Page