I have these htaccess rules for redirecting phpbb urls to xenforos friendly urls
RewriteCond %{QUERY_STRING} (^|&)t=([0-9]+)(&|$) [NC]
RewriteRule ^viewtopic\.php$ /threads/%2/? [L,R=301,NC]
RewriteCond %{QUERY_STRING} f=(\d+)$ [NC]
RewriteRule ^(viewforum\.php|viewtopic\.php)$ /forums/%1/? [L,R=301,NC]
RewriteCond %{QUERY_STRING} (^|&)p=([0-9]+)(&|$) [NC]
RewriteRule ^viewtopic\.php$ /posts/%2/? [L,R=301,NC]
which redirects phpbb urls to xenforo friendly urls like
"/viewtopic.php?t=X" will redirect to "/threads/X/" and
"/viewtopic.php?p=X" will redirect to "/posts/X/"
etc
What would its equivalent be in nginx? I tried online converters and even Plesk htaccess to nginx rules, no luck.
Plesk outputs this
if ($args ~* "(^|&)t=([0-9]+)(&|$)"){
set $rule_0 1$rule_0;
set $bref_2 $2;
set $bref_undefined $undefined;
}
if ($rule_0 = "1"){
rewrite ^/viewtopic\.php$ /threads/$bref_2/? permanent;
}
But it doesn't work. Help please.
Someone on the xenforo forum helped. I edited his script to make it work. This is the Nginx rewrite rule that works