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:
Install Magnet Module
Simply install it from the default repositories.
sudoaptitudeinstall lighttpd-mod-magnet
Dont forget to enable the module:
sudo lighty-enable-mod magnet
Lighttpd Configuration
Edit the configuration file:
sudovi/etc/lighttpd/lighttpd.conf
If you do not use vhosts, add the following to the end of the file:
Where example.com is the name of your website and /var/www/example.com is the directory where your website is.
Make a [Lua](http://en.wikipedia.org/wiki/Lua_(programming_language)) script, assuming that Lua is supported by default (I didn’t have to install anything at that time):
sudovi/var/www/example.com/rewrite.lua
Again, don’t forget change /var/www/example.com to your own setting.
Add the following Lua script into the file, thanks to Sudhaker.
attr = lighty.stat(lighty.env["physical.path"])
if(not attr)then
lighty.env["uri.path"]="/index.php"
lighty.env["physical.rel-path"]= lighty.env["uri.path"]
lighty.env["physical.path"]= lighty.env["physical.doc-root"] .. lighty.env["physical.rel-path"] end
Reload the module:
sudo/etc/init.d/lighttpd force-reload
Now visit your WordPress’s permalinks configuration, http://example.com/wp-admin/options-permalink.php and use the default or follow this guide. Enjoy!
WordPress Pretty Permalinks on Lighttpd
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:
Install Magnet Module
Simply install it from the default repositories.
Dont forget to enable the module:
Lighttpd Configuration
Edit the configuration file:
If you do not use vhosts, add the following to the end of the file:
If you do use vhosts, add that line to your vhost instead:
server.document-root = "/var/www/example.com"
magnet.attract-physical-path-to = ( server.document-root + "/rewrite.lua" )
}
Where example.com is the name of your website and /var/www/example.com is the directory where your website is.
Make a [Lua](http://en.wikipedia.org/wiki/Lua_(programming_language)) script, assuming that Lua is supported by default (I didn’t have to install anything at that time):
Again, don’t forget change /var/www/example.com to your own setting.
Add the following Lua script into the file, thanks to Sudhaker.
if (not attr) then
lighty.env["uri.path"] = "/index.php"
lighty.env["physical.rel-path"] = lighty.env["uri.path"]
lighty.env["physical.path"] = lighty.env["physical.doc-root"] .. lighty.env["physical.rel-path"]
end
Reload the module:
Now visit your WordPress’s permalinks configuration, http://example.com/wp-admin/options-permalink.php and use the default or follow this guide. Enjoy!