- From: Sandro Hawke <sandro@w3.org>
- Date: Fri, 19 Oct 2007 14:32:24 -0400
- To: "Rotan Hanrahan" <rotan.hanrahan@mobileaware.com>
- Cc: public-wiki-dev@w3.org
"Rotan Hanrahan" <rotan.hanrahan@mobileaware.com> writes: > > I figure that for paths whose root is that of MediaWiki, it's the > MediaWiki response that needs to be modified as it. See what happens > when you go to http://en.wikipedia.org/wiki/ThisPageDoesNotExist and you > see that MediaWiki responds to the unknown page by offering to create a > new one. I want to modify this behaviour so that it recognises a URL > pattern belonging to a moinmoin attachment and calculates a redirect. > That means digging into the MW code, and I'm not prepared to do that > right now. (Especially as the server belongs to W3C and I'm not in the > systeam.) Alan's suggesting it can be done in the .htaccess of the w3.org server which proxies for the wiki. It turns out he's right. This .htaccess file shows how it can be done. ================================================================ # # Demonstrate apache rewrite-rule to proxy or redirect from # a moin-moin style attachment, like # # http://www.w3.org/2007/10/cache-test/foo/bar/somepage?action=AttachFile&do=get&target=smile.jpg # # to a plain-URL style # # http://www.w3.org/2007/OWL/wiki/SandroHawke/test/somepage/attachments/smile.jpg # RewriteEngine On RewriteBase /2007/10/cache-test/ # where this file is located # Look for URL's which have a MoinMoin attachement-style query string RewriteCond %{QUERY_STRING} action=AttachFile&do=get&target=(.*) # Turn them into non-query URLs, using backreferences to the query string # and the URL. And drop the query string -- signalled by the final # "?" on the line RewriteRule ^foo/bar/(.*)$ http://www.w3.org/2007/OWL/wiki/SandroHawke/test/$1/attachments/%1? [R] ================================================================ Feel free to try it and see. I don't actually see how to do attachments in MediaWiki, but I assume that can be figured out. -- Sandro > > > > -----Original Message----- > From: public-wiki-dev-request@w3.org > [mailto:public-wiki-dev-request@w3.org] On Behalf Of Alan Ruttenberg > Sent: 19 October 2007 14:38 > To: Rotan Hanrahan > Cc: public-wiki-dev@w3.org > Subject: Re: Porting attachment URLs > > > Redirect would be best, IMO. Can you not do the redirect in the =20 > apache server or within a .htaccess? > -Alan > > On Oct 19, 2007, at 8:47 AM, Rotan Hanrahan wrote: > > > I am porting from a moinmoin tarball of the data directory to a =20 > > live MediaWiki installation. I am trying to preserve the URLs =20 > > despite the intended switch in the wiki engine. Maintaining the =20 > > page URLs seems easy enough (except perhaps for some using non-=20 > > ASCII characters in the name). However, I notice that moinmoin =20 > > attachments have URLs of the form: > > > > = > <wikipath>/PageName?action=3DAttachFile&do=3Dget&target=3Dattachment.ext > > > > > > In this case there is no obvious way for me to preserve this URL =20 > > when the attachment is moved to a MediaWiki server. I propose =20 > > therefore to map all such URLs to the following MediaWiki-friendly =20 > > form: > > > > <Wikipath>/PageName/Attachments/attachment.ext > > > > > > and include in the MediaWiki's 404 response page a message to =20 > > explain the mapping, in case anyone is looking for the URL to the =20 > > attachment. In theory I could automate this response so that an =20 > > appropriate redirect is executed, but right now I'm not keen to =20 > > manipulate the MediaWiki code. > > > > Does anyone have any comment on this strategy? > > > > ---Rotan. > > > > >
Received on Friday, 19 October 2007 18:33:42 UTC