XF 1.2 Apache Redirects To Nginx Help

Brent W

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.
 
Try this (specify the name of the vB directory):

Rich (BB 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:

Rich (BB 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;
}
 
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.
 
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.
 
Ok. Now it's just the rewrites that aren't working.

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

Rich (BB 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;
}
 
Ok. Now it's just the rewrites that aren't working.

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

Rich (BB 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.
 
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]
 
Back
Top Bottom