Can someone have a look at the above code and let me know if I've got something wrong or if this cannot be done?
Yes, your Redirect
directive is wrong. It isn't a regular expression and thus you can't have stuff like *
in it, unless you're actually trying to match against a "*".
You're probably not going to be able to do the redirect from the htaccess file in your root directory as Mediawiki uses its own htaccess. So in the htaccess file that's in the /wiki/
folder, try adding this above any rewrite rules that are already there:
RewriteCond %{QUERY_STRING} ^title=User:([^&]+) [NC]
RewriteRule ^ /memberlist.php?mode=viewprofile&un=%1 [L,R=301]
That should take care of the URLs that look like: /index.php?title=User:XYZ
RewriteRule User:(.*)$ /memberlist.php?mode=viewprofile&un=$1 [L,R=301]
And that should take care of the URLs that look like: /User:XYZ
Is there another method like adding a redirect rule in LocalSettings.php or something else?
I don't know of anything you can set in the LocalSettings.php
to do this kind of redirect, but I really wouldn't be surprised if there was some Mediawiki specific solution to this problem, maybe some add-on code that automatically redirects pages in a certain namespace.