• 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

Brent W

Well-known member
#1
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.
 

Jake Bunce

XenForo moderator
Staff member
#2
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;
}
 

Jake Bunce

XenForo moderator
Staff member
#4

Brent W

Well-known member
#7
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.
 

Brent W

Well-known member
#11
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.
Fixed the showthread problem. We just moved servers today on that site.
 

Jake Bunce

XenForo moderator
Staff member
#12
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;
}
 

Brent W

Well-known member
#13
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;
}
That seemed to do the trick.
 

Brent W

Well-known member
#18
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]