I have migrated a MediaWiki from one environment to another. Everything works fine, except for the fact that a few users have hard-coded external links (which actually link to other pages within the same wiki). For example, the old wiki was on ://foo/wiki
and the new is at ://foo.com
. On pages of the migrated wiki there are external links on the page text like ://foo/wiki/somepage
. So when they click the link on the migrated wiki they get taken back to the old wiki and are directed to ://foo/wiki/somepage
-- which is not the correct behavior (it should go to ://foo.com/somepage
). In the "externallinks" table in MySQL I have run the two statements on a single link to see if the change would update the link:
UPDATE `foowiki`.`externallinks`
SET el_to = REPLACE(el_to, '://foo/wiki', '://www.foo.com')
WHERE el_to LIKE '%://foo/wiki/somepage%';
UPDATE `foowiki`.`externallinks`
SET el_index = REPLACE(el_index, '://foo./wiki', '://com.foo.www.')
WHERE el_index LIKE '%://foo./wiki/somepage%';
When I restart the site and go to the page with the sample link I'm trying to update, the link is still the same (i.e., it links to the old wiki environment).
Is there a quick and easy way to replace all external links (in the text) with the correct prefix (i.e. go from ://foo/wiki/somerandompage
to ://foo.com/somerandompage
)? Maybe there is an even cleaner way to do it, instead of updating all the records in a MySQL table, such as intercepting the HTTP requests in LocalSettings.php and doing a single substring replace there?