RewriteCond %{QUERY_STRING} t=[0-9]
RewriteRule ^(.*)$ /vb/showthread.php?t=$1 [L]
This will match the request, but won't redirect as intended ($1
is a backreference to the captured group in the RewriteRule
pattern, not the query string). This is also an internal rewrite, not a "redirect" - as stated.
To redirect /wiki/?t=1234
to /vb/showthread.php?t=1234
, where 1234
is variable, then you should do something like the following instead:
RewriteCond %{QUERY_STRING} ^t=(\d+)
RewriteRule ^wiki/$ /vb/showthread.php?t=%1 [R=302,L]
This matches the URL-path /wiki/
and a query string that starts t=
followed by 1 or more digits. The digits are captured by the regex (\d+)
.
The %1
backreference (note the %
, not $
) is a backreference to the captured group in the preceding CondPattern.
Note that this is a 302 (temporary) redirect. But don't change this until you are sure it's working OK.