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

Can WordPress and XenForo be installed in the same directory?

Discussion in 'Off Topic' started by TheBigK, Oct 9, 2016.

  1. TheBigK

    TheBigK Well-Known Member

    I'm wondering if it's possible to install XF and WP in the same directory on the web server, without disturbing existing setup. If yes, what would need to be tweaked?
  2. Optic

    Optic Well-Known Member

    The main issue of course is only one index.php can be in the root, which one do you want as the front page?

    Would be much easier to have either WP or XF in a separate directory.
  3. SneakyDave

    SneakyDave Well-Known Member

    Well, you'd have to find a way to use both WordPress' and Xenforo's index.php file. That might be the hardest part
  4. TheBigK

    TheBigK Well-Known Member

    Well, the main reason is that I do not wish to disturb my existing XF setup. Is it even possible to keep the URL structure just as it is; while switching XF to a new directory?


    Current URL: domain.com/threads/thread-title.123/
    With XF in the root folder.

    Can I now switch XF to a sub-folder and still have the above URL structure?
  5. Optic

    Optic Well-Known Member

    I think you could use mod_rewrite in .htaccess to redirect all the XF URLs to point to XF being in a subfolder? You'd have to cover at least these suffixes:
    (also assuming it doesn't conflict with any XF route filters you may have defined)
  6. TheBigK

    TheBigK Well-Known Member

    Interesting. There aren't any custom route filters.

    Could you please tell me what'd be the .htaccess rule if the subfolder I'm moving to is, say /xf/ from root ( / ) ?
  7. Optic

    Optic Well-Known Member

  8. TheBigK

    TheBigK Well-Known Member

    Interesting. I think the rule is straightforward if you want to point to subdirectory; but when the install files are in a sub-directory, I think it'd be kinda difficult to keep the URL intact.

    @Jake Bunce - Is it possible to keep the URL intact while moving XF install from root to a subdirectory?
  9. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Normally you would setup a selective redirect to redirect the old XF routes to the new location. Use these rules in the web root's .htaccess file:

    RewriteEngine on
    RewriteRule ^(threads|forums|members|posts|attachments)/(.*)$ /newdir/$1/$2 [R=301,L]
    But I have never done exactly what you want. I suspect it is possible. There may be special considerations with the request headers and pathing within XenForo. I will experiment with this later tonight. Are you on Apache?
  10. TheBigK

    TheBigK Well-Known Member

    I'm on LiteSpeed, which is a drop replacement of Apache.
  11. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I am encountering expected problems with this directory aliasing. I haven't been able to get it working.
  12. TheBigK

    TheBigK Well-Known Member

    Hmm. Looks like the only way to get this to work is to move XF in its own subdirectory and setup redirects.
  13. DPF

    DPF Active Member

    You can get them to work in the same directory pretty easy. Logistically though it could become muddled when they are competing for URLs but that's easily overcame by giving Wordpress custom URL settings in the admin area.

    A quick google search of Wordpress rename index.php yielded good results
    TheBigK likes this.

Share This Page