<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>LongSpine.com &#187; mod_magnet</title>
	<atom:link href="http://longspine.com/tag/mod_magnet/feed/" rel="self" type="application/rss+xml" />
	<link>http://longspine.com</link>
	<description>Yes, we are lazy.</description>
	<lastBuildDate>Mon, 14 May 2012 11:03:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>WordPress Pretty Permalinks on Lighttpd</title>
		<link>http://longspine.com/how-to/wordpress-pretty-permalinks-on-lighttpd/</link>
		<comments>http://longspine.com/how-to/wordpress-pretty-permalinks-on-lighttpd/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 00:50:04 +0000</pubDate>
		<dc:creator>poomk</dc:creator>
				<category><![CDATA[how-to]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mod_magnet]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://longspine.com/?p=67</guid>
		<description><![CDATA[At some point in your WordPress-life, you need a pretty permalink (name of the link at the navigation bar). On Apache we can easily use the rewrite module (mod_rewrite) which works pretty well. On the other hand, I found it confusing to make the equivalent rewrite rule on Lighttpd, therefore I use the other module [...]]]></description>
			<content:encoded><![CDATA[<p>At some point in your WordPress-life, you need a pretty permalink (name of the link at the navigation bar). On Apache we can easily use the rewrite module (mod_rewrite) which works pretty well. On the other hand, I found it confusing to make the equivalent rewrite rule on Lighttpd, therefore I use the other module called magnet module (mod_magnet) instead. And these are some simple steps how to use it:</p>
<p><strong>Install Magnet Module</strong></p>
<p>Simply install it from the default repositories.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> lighttpd-mod-magnet</div></div>
<p>Dont forget to enable the module:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> lighty-enable-mod magnet</div></div>
<p><strong>Lighttpd Configuration</strong></p>
<p>Edit the configuration file:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>lighttpd<span style="color: #000000; font-weight: bold;">/</span>lighttpd.conf</div></div>
<p>If you <strong>do not</strong> use vhosts, add the following to the end of the file:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">magnet.attract-physical-path-to = <span style="color: #7a0874; font-weight: bold;">&#40;</span> server.document-root + <span style="color: #ff0000;">&quot;/rewrite.lua&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span></div></div>
<p>If you <strong>do</strong> use vhosts, add that line to your vhost instead:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">$HTTP</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">&quot;host&quot;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> =~ <span style="color: #ff0000;">&quot;(^|\.)example\.com&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
server.document-root = <span style="color: #ff0000;">&quot;/var/www/example.com&quot;</span><br />
magnet.attract-physical-path-to = <span style="color: #7a0874; font-weight: bold;">&#40;</span> server.document-root + <span style="color: #ff0000;">&quot;/rewrite.lua&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span></div></div>
<p>Where <em>example.com</em> is the name of your website and <em>/var/www/example.com</em> is the directory where your website is.</p>
<p>Make a <a href="http://en.wikipedia.org/wiki/Lua_(programming_language)">Lua</a> script, assuming that Lua is supported by default (I didn&#8217;t have to install anything at that time):</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>example.com<span style="color: #000000; font-weight: bold;">/</span>rewrite.lua</div></div>
<p>Again, don&#8217;t forget change <em>/var/www/example.com</em> to your own setting.</p>
<p>Add the following Lua script into the file, thanks to <a href="http://sudhaker.com/web-development/wordpress/wordpress-permalinks-lighttpd.html">Sudhaker</a>.</p>
<div class="codecolorer-container lua default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="lua codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">attr <span style="color: #66cc66;">=</span> lighty<span style="color: #66cc66;">.</span>stat<span style="color: #66cc66;">&#40;</span>lighty<span style="color: #66cc66;">.</span>env<span style="color: #66cc66;">&#91;</span><span style="color: #ff6666;">&quot;physical.path&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><br />
<br />
<span style="color: #aa9900; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #aa9900; font-weight: bold;">not</span> attr<span style="color: #66cc66;">&#41;</span> <span style="color: #aa9900; font-weight: bold;">then</span><br />
lighty<span style="color: #66cc66;">.</span>env<span style="color: #66cc66;">&#91;</span><span style="color: #ff6666;">&quot;uri.path&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #ff6666;">&quot;/index.php&quot;</span><br />
lighty<span style="color: #66cc66;">.</span>env<span style="color: #66cc66;">&#91;</span><span style="color: #ff6666;">&quot;physical.rel-path&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> lighty<span style="color: #66cc66;">.</span>env<span style="color: #66cc66;">&#91;</span><span style="color: #ff6666;">&quot;uri.path&quot;</span><span style="color: #66cc66;">&#93;</span><br />
lighty<span style="color: #66cc66;">.</span>env<span style="color: #66cc66;">&#91;</span><span style="color: #ff6666;">&quot;physical.path&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> lighty<span style="color: #66cc66;">.</span>env<span style="color: #66cc66;">&#91;</span><span style="color: #ff6666;">&quot;physical.doc-root&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">..</span> lighty<span style="color: #66cc66;">.</span>env<span style="color: #66cc66;">&#91;</span><span style="color: #ff6666;">&quot;physical.rel-path&quot;</span><span style="color: #66cc66;">&#93;</span><br />
<span style="color: #aa9900; font-weight: bold;">end</span></div></div>
<p>Reload the module:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>lighttpd force-reload</div></div>
<p>Now visit your WordPress&#8217;s permalinks configuration, <em>http://example.com/wp-admin/options-permalink.php</em> and use the default or follow this <a href="http://codex.wordpress.org/Using_Permalinks">guide</a>. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://longspine.com/how-to/wordpress-pretty-permalinks-on-lighttpd/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

