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

XF 1.5 How to remove the subfolder in URL (.htaccess)

Discussion in 'XenForo Questions and Support' started by chrisbruijnes, Aug 27, 2016.

  1. chrisbruijnes

    chrisbruijnes Member

  2. Brogan

    Brogan XenForo Moderator Staff Member

    Why don't you just move the installation to the domain root?
  3. chrisbruijnes

    chrisbruijnes Member

    That is an option, however what about my other pages? How would I do that?

    I still want to keep https://www.glowstonepvp.com/vote etc.. as it is.

    I got many more files and folders which should stay as it is.
  4. Arty

    Arty Well-Known Member

    In .htaccess find this line
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    add your custom folders and files to it.
  5. chrisbruijnes

    chrisbruijnes Member

    So what you are saying is: Replace the forums into the root folder and add my custom folders/files into that .htaccess line?

    What about my own .htaccess which I have now, which takes care of the pages right now?

    RewriteRule ^([A-z0-9]+)$ index.php?page=$1
    Where am I supposed to place that?
  6. Arty

    Arty Well-Known Member

    If only index.php conflicts with XenForo files, you can rename it, fiddle with htaccess a bit to redirect old pages to your old php file and the rest of files to XenForo. But if its more files that share names with XenForo files, then probably would be easier to leave everything as is.
  7. chrisbruijnes

    chrisbruijnes Member

    But that .htacces line which you sent, do I need to add my own files into that one? I am just worrying about 1 thing; I need htacces to change ?page=vote to /vote, can I add that in the same Xenforo .htaccess? I don't need an index.php file anymore for my own site, just other folders such as bans etc..

    See here: https://gyazo.com/b28be7b4cc0bfac4e589a627aa367974
  8. Arty

    Arty Well-Known Member

    Looks like a complex app, so better leave it as it is. Mixing files from 2 apps might get messy.
  9. chrisbruijnes

    chrisbruijnes Member

    I can just leave the folder bans and Multicraft and place all those other files in 1 folder and then fix those page routes with .htaccess? Wouldn't that work?
  10. Arty

    Arty Well-Known Member

    If you can adjust your vote script, then sure.

    In .htaccess you need to do this: find
        RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    add your folders there, including vote:
        RewriteRule ^(vote/|bans/|Multicraft/|data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    then after this line
    RewriteRule ^.*$ index.php [NC,L]
    copy rules from your old .htaccess. Rename your old index.php to something else, in your rule change index.php to new file name.

    Code in your old index.php might need adjustments, you must know what to change before doing any changes above. If you don't know what to change there, don't do this.

Share This Page