]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/redirect.mdwn
rename bugs/redirect.mdwn to todo/redirect.mdwn
[ikiwiki.git] / doc / todo / redirect.mdwn
1 I suppose this isn't technically a bug, but whetever.
2
3 I want symbolic links to be rendered as HTTP redirects. For example,
4 if we do this,
5
6     touch foo.mkdwn
7     ln -s foo.mkdwn bar.mkdwn
8     git push baz.branchable.com
9
10 then the following command should print 302
11
12     curl -o /dev/null -s -w "%{http_code}" http://baz.thomaslevine.com/bar/
13
14 > An interesting idea, but it conflicts somewhat with wanting symlinks to be
15 > treated as the referenced file when it's safe to do so, which would be
16 > great for [[todo/git-annex support]], and also good to avoid duplication
17 > for files in system-wide underlays.
18 >
19 > Also, I don't think this is possible without help from the web server
20 > configuration: for instance, under Apache, I believe the only way to get
21 > an HTTP 302 redirect is via Apache-specific `.htaccess` files or
22 > system-level Apache configuration.
23 >
24 > In current ikiwiki, you can get a broadly similar effect by either
25 > using \[[!meta redir=foo]] (which does a HTML `<meta>` redirect)
26 > or reconfiguring the web server. --[[smcv]]
27
28 >> The CGI spec (http://www.ietf.org/rfc/rfc3875) says that a CGI can cause a redirect by returning a Location: header.
29 >> So it's possible; desirable (due to your point about conflicting with git-annex support) is a different matter.
30
31 >>> One of the major things that separates ikiwiki from other wiki software
32 >>> is that ikiwiki is a wiki compiler: ordinary page-views are purely
33 >>> static HTML, and the CGI only gets involved when you do something
34 >>> that really has to be dynamic (like an edit).
35 >>>
36 >>> However, there is no server-independent static content that ikiwiki
37 >>> could write out to the destdir that would result in that redirect.
38 >>>
39 >>> If you're OK with requiring the [[plugins/404]] plugin (and a
40 >>> web server where it works, which I think still means Apache) then
41 >>> it would be possible to write a plugin that detected symlinks,
42 >>> stored them in the `%wikistate`, and used them to make the
43 >>> [[plugins/404]] plugin (or its own hook similar to the one
44 >>> in that plugin) do a 302 redirect instead of a 404.
45 >>> Similarly, a plugin that assumed a suitable Apache
46 >>> configuration with fairly broad `AllowOverrides`,
47 >>> and wrote out `.htaccess` files, would be a feasible thing
48 >>> for someone to write.
49 >>>
50 >>> I don't think this is a bug; I think it's a request for a
51 >>> feature that not everyone will want. The solution to those
52 >>> is for someone who wants the feature to
53 >>> [[write a plugin|plugins/write]]. --[[smcv]]