Sophie

Sophie

distrib > Mageia > 6 > x86_64 > media > core-updates > by-pkgid > a2ac79ac252ef7b89f2f0fc449728720 > files > 718

ikiwiki-3.20190228-1.1.mga6.noarch.rpm

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>redirections for usedirs</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="stylesheet" href="../style.css" type="text/css" />

<link rel="stylesheet" href="../local.css" type="text/css" />










</head>
<body>

<div class="page">

<div class="pageheader">
<div class="header">
<span>
<span class="parentlinks">

<a href="../index.html">ikiwiki</a>/ 

<a href="../tips.html">tips</a>/ 

</span>
<span class="title">
redirections for usedirs

</span>
</span>



</div>









</div>





<div id="pagebody">

<div id="content" role="main">
<p>Want to turn on the <code>usedirs</code> setting on an existing wiki without breaking
all the links into it?</p>

<h1>Apache and RewriteEngine</h1>

<p>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.</p>

<pre><code># pages
RewriteCond &#036;1 !^/~          # these pages
RewriteCond &#036;1 !^/doc/       # are not part of
RewriteCond &#036;1 !^/ajaxterm   # the wiki, so
RewriteCond &#036;1 !^/cgi-bin/   # don't rewrite them
RewriteCond &#036;1 !.*/index&#036;
RewriteRule (.+).html&#036; &#036;1/ [R]

# rss feeds
RewriteCond &#036;1 !^/~
RewriteCond &#036;1 !.*/index&#036;
RewriteRule (.+).rss&#036; &#036;1/index.rss

# atom feeds
RewriteCond &#036;1 !^/~
RewriteCond &#036;1 !.*/index&#036;
RewriteRule (.+).atom&#036; &#036;1/index.atom
</code></pre>

<h1>lighttpd and mod_redirect</h1>

<p>The following example is exactly the same thing written for lighttpd by using mod_redirect:</p>

<pre><code>&#036;HTTP["url"] !~ "^/(~|doc/|ajaxterm|cgi-bin/)" {
  &#036;HTTP["url"] !~ "^/(.*/index\.(html|rss|atom))" {
    url.redirect = ( 
      "(.*)\.html&#036;" =&gt; "&#036;1/",
      "(.*)\.(atom|rss)&#036;" =&gt; "&#036;1/index.&#036;2"     
    )
  } 
} 
</code></pre>

</div>







</div>

<div id="footer" class="pagefooter" role="contentinfo">

<div id="pageinfo">






<div id="backlinks">
Links:

<a href="./howto_avoid_flooding_aggregators.html">howto avoid flooding aggregators</a>

<a href="./switching_to_usedirs.html">switching to usedirs</a>


</div>






<div class="pagedate">
Last edited <span class="date">Tue Feb 26 23:01:54 2019</span>
<!-- Created <span class="date">Wed Apr 11 01:17:05 2007</span> -->
</div>

</div>


<!-- from ikiwiki -->
</div>

</div>

</body>
</html>