RewriteEngine On
# thread redirect with page
RewriteRule ^showthread\.php/([0-9]+)-[^/]+/page([0-9]+)$ /XFpath/index.php?threads/$1/page-$2 [R=301,L]
# thread redirect
RewriteRule ^showthread\.php/([0-9]+)-.*$ /XFpath/index.php?threads/$1/ [R=301,L]
# thread redirect
RewriteCond %{QUERY_STRING} (^|\?)([0-9]+)-.*$
RewriteRule ^showthread\.php$ /XFpath/index.php?threads/%2/ [R=301,L]
# thread redirect
RewriteCond %{QUERY_STRING} (^|\?)t=([0-9]+)$
RewriteRule ^showthread\.php$ /XFpath/index.php?threads/%2/ [R=301,L]
# post redirect
RewriteCond %{QUERY_STRING} (^|\?)p=([0-9]+)($|&)
RewriteRule ^showthread\.php /XFpath/index.php?posts/%2/ [R=301,L]