0

Following the steps at:

http://www.mediawiki.org/wiki/Manual:Short_URL
http://www.mediawiki.org/wiki/Manual:Short_URL/Apache

I have already migrate my wiki page from URLs:

http://acacha.org/mediawiki/index.php/ARTICLENAME

to

http://acacha.org/mediawiki/ARTICLENAME

For example now to see Apache article you can go to:

http://acacha.org/mediawiki/Apache

But now my problem is the following old link:

http://acacha.org/mediawiki/index.php/Apache

Mediawiki interpret thar as an article with name"index.php/Apache". I don't mind not to be able to write articles starting with index.php/ but for SEO is very important that old links redirect to new links. For example I want to redirect from URL:

http://acacha.org/mediawiki/index.php/Apache

to

http://acacha.org/mediawiki/Apache

My current config is:

Apache VirtualHost (file /etc/apache2/conf-available/mediawiki.conf). Follow:

ServerName acacha.org
ServerAlias www.acacha.org
DocumentRoot /var/lib/acacha_mediawiki

php_value upload_max_filesize  20M

#DOES NOT WORK:
#AliasMatch ^/mediawiki/index.php(.*) /var/lib/acacha_mediawiki/w/index.php

<Directory /var/lib/acacha_mediawiki/>
        #If this is uncommented new files uploaded give a Forbidden Error. Example:
        # http://acacha.org/mediawiki/upload/c/c0/Francesc_fores_identity.png --> SOLVED ADDING +SymLinksIfOwnerMatch above
        Options +FollowSymLinks +SymLinksIfOwnerMatch
        AllowOverride All

        ## http://www.mediawiki.org/wiki/Manual:Short_URL/Apache
        # Enable the rewrite engine
        RewriteEngine On
        LogLevel alert rewrite:trace2

        # Short url for wiki pages: old pages
        #DOES NOT WORK:
        #RewriteRule ^/?mediawiki/index.php(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L,QSA]
        #RewriteRule ^/?mediawiki/index.php/(.*)$ %{DOCUMENT_ROOT}/w/index.php/$1 [L,QSA]

        # Short url for wiki pages
        RewriteRule ^/?mediawiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L,QSA]

        # Redirect / to Main Page
        RewriteRule ^/*$ %{DOCUMENT_ROOT}/w/index.php [L,QSA]

        Require all granted

</Directory>
...

Mediawiki is installed at:

/var/lib/acacha_mediawiki/w

And LocalSettings file:

...
define('MW_INSTALL_PATH','/var/lib/acacha_mediawiki/w');
...
$wgScriptPath       = "/w";
$wgScriptExtension  = ".php";

$wgArticlePath      = "/mediawiki/$1";
$wgUsePathInfo = true;
...

Is possible to migrate an existing mediawiki page to shortURLs and create a redirect from old URLs to new ones?

1 Answers1

1

Ok. I find a solution. I added a redirectMatch:

RedirectMatch 301 /mediawiki/index.php$ http://acacha.org/mediawiki/Main_Page
RedirectMatch 301 /mediawiki/index.php/(.*) http://acacha.org/mediawiki/$1

Before:

 <Directory /var/lib/acacha_mediawiki/>