VBSEO --> XF Rewrite Rules for Nginx?

Coop1979

Well-known member
I'm finishing up an import from vB 3.8 + VBSEO and am trying to setup the rewrite rules for Nginx. Here are the rules for Apache:

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

I tried using this site to convert the RewriteRules, but this rewrite doesn't seem to be working. Any ideas?

Code:
        location /forums {
        rewrite ^/forums/[^/]+/([d]+)-.+.html /showthread.php?t=$1 last;
}
 
Instead of:

([d]+)

Try:

([0-9]+)

Or:

(\d+)

Also try getting rid of the directory name in your rewrite. So overall try this:

Code:
location /forums/ {
	rewrite [^/]+/([0-9]+)-.+\.html /forums/showthread.php?t=$1 last;
}
 
Ran into an un-anticipated hiccup with some links this morning. If the vbSEO link is a direct link to a post, it appends "#post1234" to the end of the link. The url redirection carries that "#post1234" through in the url, but in order for XenForo to actually go to the correct post, the end of the url needs to be formatted as "#post-1234".

For example, the redirected link is currently this:

Code:
http://mysite.com/threads/18-000-please-help-me.88518/#post1241833
But needs to be this:
Code:
http://mysite.com/threads/18-000-please-help-me.88518/#post-1241833

How can I add that '-' to the redirected link using my Nginx re-write rule?
 
Top Bottom