views:

59

answers:

1

Ok, so we are using vBulletin..ya I know. Which is within our Kohana based system. The breakdown is as follows.

This is how vBulletin marks its member URL's http://server.com/forum/member.php?21148-username

I need to redirect them to this. http://server.com/member_profile/view/vb/21148

In my .htaccess I have this rule

RedirectMatch 301 /forum/member.php(.*) /member_profile/view/vb/$1

End Result: http://server.com/member_profile/view/vb/?21148-username

It has a ? and i need to remove -username

I've tried several variations using $2 and so on, but it doesn't seem to work with RedirectMatch.

Any help is much appreciated.

A: 

You need a bit more in your .htaccess to accomplish this. Something like this ought to do the trick:

RewriteCond %{QUERY_STRING} ^([0-9]+)\-.*$
RewriteRule ^forum/member.php$ /member_profile/view/vb/%1? [R=301,L]

That will take: http://server.com/forum/member.php?21148-username

and return: http://server.com/member_profile/view/vb/21148

ABach