Topic on Project:Support desk

Ethwald (talkcontribs)

Hi,


I built a new wiki and migrated all the files from our old wiki.

Is there a way to redirect paths? Say if a user access a wiki page/URLs from the old wiki it will redirect to the new wiki including the path. Because what is happening right now is it redirects but they all go to main page of the new wiki.

A lot of links within the wiki point to absolute URL within wiki itself. Is there a way to do it properly?

Ernstkm (talkcontribs)

If you are on a shared hosting platform where you do not have full administrative access to the web server, this could be a challenge, but what you want is documented here for the Apache web server, for example.

It's a (rather broad) web server administration question, rather than a MediaWiki question, and seems beyond the scope of what people could feasibly help you with here without more specifics.

As far as fixing absolute URLs within the wiki, the proper way to do it, as I'm sure you know, is to use [[wikilinks]], or the localurl: or fullurl: magic words, if for some reason you needed more control over the URL than regular wikilinks provide. Both of those let you get an absolute URL for resources on the wiki without hard-coding anything (that you would need to change later if you're ever in this situation again). You could simply search-and-replace all of the articles with the absolute URLs within the wiki interface itself, or do a SQL UPDATE query on the underlying database to fix them.

There is also pywikibot, which is a Python solution for doing things like this, but requires programming (even more so than SQL queries).

Hope that helps. A little.

Ethwald (talkcontribs)

Thank you, will check it out

Bawolff (talkcontribs)

yes, for example with apache rewrite rules. You need to be more specific about how you are redirecting things currently and what your setup looks like currently for any advice more specific than that.

Ethwald (talkcontribs)

@Bawolff thanks for the reply. I would like to redirect it like this..

Since many users bookmarked some important pages from our old wiki say the below example:

http://oldwiki.sample.ph/mediawiki/index.php/somepage1#somepage1.1

will redirect to new wiki: http://newwiki.sample.ph/mediawiki/index.php/somepage1#somepage1.1

I have migrated all the data from old to new and I need to setup the redirection. Redirecting all the pages from old to new, can this be done? Sorry I am not that technical but I will read on it if you can help me where to look for possible solution/s.


Regards

Bawolff (talkcontribs)

which web server are you using?

Ethwald (talkcontribs)

Apache2

Bawolff (talkcontribs)
Ethwald (talkcontribs)

Hi,

Can you help me with this please?


Alias /test1 /var/www/html/test1

Alias /test2 /var/www/html/test2

Alias /Wiki /var/www/html/mediawiki

RewriteEngine On

RewriteCond %{HTTP_HOST} !newwiki.samplesite.com$ [NC]

RewriteRule ^/(.*)$ http://newwiki.samplesite.com/$1 [L,R=301]

----

The redirection works. It redirects to newwiki.samplesite.com including paths..

But it redirects also the test1 and test2 sites. Is there a way to only redirect the Alias /Wiki?

Your reply is very much appreciated.

Ethwald (talkcontribs)

Thanks! will read on it.

Reply to "Redirecting paths"