Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When clicked, "[[Media:spreadsheet.xls]]" successfully loads the spreadsheet in Excel.

However, a page containing "#REDIRECT [[Media:spreadsheet.xls]]" just goes to the "mywiki/index.php?title=Media:spreadsheet.xls" page instead of serving up the actual spreadsheet file.

How can I create a redirect so that it loads the file directly, instead of going to the "index.php" 'meta' page?

share|improve this question
up vote 2 down vote accepted

Instead of using an ordinary page with a redirect, create a template which produces the direct link, and update the template as needed.

share|improve this answer
Great, not sure why I didn't think of this, but that's just what I wanted! – Chris Apr 17 '11 at 11:38

The #REDIRECT redirects one page to another page. It cannot redirect to a media item.

The page you see when you redirect to a media item is just another Wiki page (albeit an auto-generated one).

You would think that if you could somehow insert a #REDIRECT into that page that it would do what you want, but no...

Double redirects

A double redirect is a page redirecting to a page which is itself a redirect, and it will not work. Instead, people will be presented with a view of the next redirect page. This is a deliberate restriction, partly to prevent infinite loops, and partly to keep things simple.

However, you could look out for double redirects and eliminate them by changing them to be 1-step redirects instead. You are most likely to need to do this after a significant page move. Use the "what links here" toolbox link to find double redirects to a particular page, or use Special:DoubleRedirects to find them throughout the whole wiki.

So I am sorry, but unless you fancy re-writing how parts of MediaWiki work, you are stuck with having it redirect to the media page.

share|improve this answer
That's a shame. There's basically a spreadsheet which is updated daily, which I had hoped to link to from several places in the Wiki, and still keep a history of the older versions. I realise I could simply replace the file in the wiki, but this makes it a little harder for end users (as does the meta page). Do you (or anyone else) have any suggestions of the best way to do this? – Chris Apr 14 '11 at 8:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .