aboutsummaryrefslogtreecommitdiff
path: root/doc/tips/redirections_for_usedirs.mdwn
diff options
context:
space:
mode:
Diffstat (limited to 'doc/tips/redirections_for_usedirs.mdwn')
-rw-r--r--doc/tips/redirections_for_usedirs.mdwn39
1 files changed, 39 insertions, 0 deletions
diff --git a/doc/tips/redirections_for_usedirs.mdwn b/doc/tips/redirections_for_usedirs.mdwn
new file mode 100644
index 000000000..588b9f4b5
--- /dev/null
+++ b/doc/tips/redirections_for_usedirs.mdwn
@@ -0,0 +1,39 @@
+Want to turn on the `usedirs` setting on an existing wiki without breaking
+all the links into it?
+
+#Apache and RewriteEngine
+
+Here's a way to do it for Apache, using the
+RewriteEngine. This example is for a wiki at the top of a web site, but can
+be adapted to other situations.
+
+ # pages
+ RewriteCond $1 !^/~ # these pages
+ RewriteCond $1 !^/doc/ # are not part of
+ RewriteCond $1 !^/ajaxterm # the wiki, so
+ RewriteCond $1 !^/cgi-bin/ # don't rewrite them
+ RewriteCond $1 !.*/index$
+ RewriteRule (.+).html$ $1/ [R]
+
+ # rss feeds
+ RewriteCond $1 !^/~
+ RewriteCond $1 !.*/index$
+ RewriteRule (.+).rss$ $1/index.rss
+
+ # atom feeds
+ RewriteCond $1 !^/~
+ RewriteCond $1 !.*/index$
+ RewriteRule (.+).atom$ $1/index.atom
+
+#lighttpd and mod_redirect
+
+The following example is exactly the same thing written for lighttpd by using mod_redirect:
+
+ $HTTP["url"] !~ "^/(~|doc/|ajaxterm|cgi-bin/)" {
+ $HTTP["url"] !~ "^/(.*/index\.(html|rss|atom))" {
+ url.redirect = (
+ "(.*)\.html$" => "$1/",
+ "(.*)\.(atom|rss)$" => "$1/index.$2"
+ )
+ }
+ } \ No newline at end of file