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

XF 1.2 Apache Redirects To Nginx Help

Discussion in 'XenForo Questions and Support' started by BamaStangGuy, Oct 9, 2013.

  1. BamaStangGuy

    BamaStangGuy Well-Known Member

    I moved a forum from vBulletin to xenForo and have the following in .htaccess:

    Code:
    RewriteRule f[\d]+/.+-([\d]+)/index([\d]+).html showthread.php?t=$1&page=$2 [NC,L]
    RewriteRule f[\d]+/.+-([\d]+)/ showthread.php?t=$1 [NC,L]
    RewriteRule f([\d]+)/index([\d]+).html forumdisplay.php?f=$1&page=$2 [NC,L]RewriteRule f([\d]+)/ forumdisplay.php?f=$1 [NC,L]
    I would like to move this forum to Nginx server but need to know what to replace those rewrites with.
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Try this (specify the name of the vB directory):

    Code:
    location /vb/ {
    	rewrite f[\d]+/.+-([\d]+)/index([\d]+).html showthread.php?t=$1&page=$2 last;
    	rewrite f[\d]+/.+-([\d]+)/ showthread.php?t=$1 last;
    	rewrite f([\d]+)/index([\d]+).html forumdisplay.php?f=$1&page=$2 last;
    	rewrite f([\d]+)/ forumdisplay.php?f=$1 last;
    }
    
    You may need to specify the full web path for the PHP scripts. For example, if they are in your XF directory:

    Code:
    location /vb/ {
    	rewrite f[\d]+/.+-([\d]+)/index([\d]+).html /xf/showthread.php?t=$1&page=$2 last;
    	rewrite f[\d]+/.+-([\d]+)/ /xf/showthread.php?t=$1 last;
    	rewrite f([\d]+)/index([\d]+).html /xf/forumdisplay.php?f=$1&page=$2 last;
    	rewrite f([\d]+)/ /xf/forumdisplay.php?f=$1 last;
    }
    
     
  3. BamaStangGuy

    BamaStangGuy Well-Known Member

  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  5. BamaStangGuy

    BamaStangGuy Well-Known Member

    I checked but the table is the same as in 301 config file. Pm you screenshot to show.
     
  6. BamaStangGuy

    BamaStangGuy Well-Known Member

    Thanks Jake. I used an ID that was past the import date without thinking. Everything seems to be working great.
     
  7. BamaStangGuy

    BamaStangGuy Well-Known Member

    This URL http://3.7mustang.com/vb/f81/i-hate-dumb-people-207136/ is not working with the following:

    Code:
      location /vb/ {
        rewrite f[\d]+/.+-([\d]+)/index([\d]+).html showthread.php?t=$1&page=$2 last;
        rewrite f[\d]+/.+-([\d]+)/ showthread.php?t=$1 last;
        rewrite f([\d]+)/index([\d]+).html forumdisplay.php?f=$1&page=$2 last;
        rewrite f([\d]+)/ forumdisplay.php?f=$1 last;
    }
    /vb/ is the actual directory that vb was installed in. xenForo is installed in the root.
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Where are the redirect scripts (e.g. showthread.php)?
     
  9. BamaStangGuy

    BamaStangGuy Well-Known Member

    in the /vb/ folder.

    The forum used to be located in /vb/

    When we converted to xenforo we moved the forum to the root folder which is simply http://3.7mustang.com/
     
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Ignoring the rewrites, this redirect script itself isn't working:

    http://3.7mustang.com/vb/showthread.php?t=207136

    It should redirect to the thread in XF, or at least the index page in XF in the case of an id map failure.

    Double check the existence of showthread.php, and check the 301config.php file to ensure a correct path to XF.
     
  11. BamaStangGuy

    BamaStangGuy Well-Known Member

    Fixed the showthread problem. We just moved servers today on that site.
     
  12. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Ok. Now it's just the rewrites that aren't working.

    To remove all doubt, try using full web paths for everything:

    Code:
    location /vb/ {
    	rewrite ^/vb/f[\d]+/.+-([\d]+)/index([\d]+).html /vb/showthread.php?t=$1&page=$2 last;
    	rewrite ^/vb/f[\d]+/.+-([\d]+)/ /vb/showthread.php?t=$1 last;
    	rewrite ^/vb/f([\d]+)/index([\d]+).html /vb/forumdisplay.php?f=$1&page=$2 last;
    	rewrite ^/vb/f([\d]+)/ /vb/forumdisplay.php?f=$1 last;
    }
    
     
    BamaStangGuy likes this.
  13. BamaStangGuy

    BamaStangGuy Well-Known Member

    That seemed to do the trick.
     
  14. BamaStangGuy

    BamaStangGuy Well-Known Member

  15. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The redirect (and rewrite) is working for me, but XenForo says the forum is not found. Was that particular forum deleted after migrating?
     
    BamaStangGuy likes this.
  16. BamaStangGuy

    BamaStangGuy Well-Known Member


    Thanks, didn't even pay attention to that. :oops:
     
  17. BamaStangGuy

    BamaStangGuy Well-Known Member

  18. BamaStangGuy

    BamaStangGuy Well-Known Member

    What about these two to nginx?

    RewriteRule [^/]+/([\d]+)-.+-([\d]+).html showthread.php?t=$1&page=$2 [NC,L]

    RewriteRule [^/]+/([\d]+)-.+.html showthread.php?t=$1 [NC,L]
     
  19. Mike

    Mike XenForo Developer Staff Member

    Probably worth trying: http://winginx.com/htaccess

    Though you may need to modify the output to reflect the /vb/ directory that's been mentioned in previous posts.
     
    BamaStangGuy likes this.
  20. BamaStangGuy

    BamaStangGuy Well-Known Member

    Nice, didn't know that existed. Thanks
     

Share This Page