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

XF 1.2 Redirects from sub-directory to root

Discussion in 'XenForo Questions and Support' started by Andy.N, Oct 3, 2013.

  1. Andy.N

    Andy.N Well-Known Member

    Can anyone help with a nginx rewrite rules that redirect all urls of the form


    I have XF installed on root and the first type of url was the result of XF previously being in /forum/ folder.

    I have now moved it to root but Google reports thousands of 404 so I like to redirect them.
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    location /forum/ {
    	rewrite ^/forum/(.*)$ /$1 permanent;
    That should do it.
    Andy.N likes this.
  3. Andy.N

    Andy.N Well-Known Member

  4. Andy.N

    Andy.N Well-Known Member

    I spoke too soon. Just realized that I have a route filter in place (forums/-> forum/)
    After adding this rule, all the categories url gave 404
    Going to site.com/forum/ will just display portal.

    EDIT: it seems with the route filter in place, categories will be site.com/forum/category.1/
    adding that rule in will break the url.
    Last edited: Oct 3, 2013
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You could attempt to distinguish the two patterns, but ideally you need to remove the conflict by removing that route change.

Share This Page