I've transferred an old custom-made site to Mediawiki and I have many internal and external links to my old pages that I want to redirect to the appropriate wiki page.
There are many links to the old site of the form:
https://www.example.com/?productOrPublisher=XXXXXX
with the wiki, the relevant page would be
https://www.example.com/index.php?title=XXXXXX
With all the attempts below, the URL remains as
https://www.example.com/?productOrPublisher=XXXXXX
and the front page of the site always renders.
I've tried
RedirectMatch 301 "^\?productOrPublisher=(.*?)$" "https://www.example.com/index.php?title=$1"
and
RewriteRule ^\?productOrPublisher=(.*) https://www.example/index.php?title=$1 [L,R=permanent]
but these don't work. I'm not surprised, because I think I have to be extracting from
%{QUERY_STRING}
somehow, but I don't know how.
I tried to adapt information from the 'Rewrite query string' section of https://httpd.apache.org/docs/2.4/rewrite/remapping.html for example this:
(.*(?:^|&))?productOrPublisher=(.*?)$
replacing with
index.php?title=$2
I tested this in notepad++ and there I can't get rid of the ?
after the /
so I get https://www.example.com/?index.php?title=FreeMind
and I tried it in .htaccess
but it leaves the URL unchanged.
There are many other redirects in .htaccess
and have placed these attempts near the top after RewriteEngine On
and RewriteBase /
to try to pre-empt others.