A Path Less Taken

Breaking with convention in a very conventional fashion. Powered by WordPress

"What would you attempt to do if you knew you could not fail?"
Dr. Robert Schuller

Monday, May 25, 2009

Category: Web Development Author: JJ 0 Comments

Although I’m sure it should be trivial to accomplish, I was having trouble getting the lighttpd mod_rewrite rules that I created working for Habari. I had already enabled the mod_rewrite server module, but I was struggling to get the syntax right. After much trial and error and some helpful web references I found the solution. I share it here in the hopes that you don’t struggle as I did.

I was working inside of my lighttpd-inc.conf file. As stated, I had uncommented the mod_rewrite server module. Then I added the statements below:

1
2
3
4
5
6
$HTTP["host"] =~ "localhost:81" {
	url.rewrite-once = (
		"^/habari/(?!scripts/|3rdparty/|system/|doc/|user/(?:themes/|files/|plugins/|locales/|sites/))[^?]*(\?(.*))?" => "/habari/index.php$1",
		"^/habari/(?!scripts/|3rdparty/|system/|doc/)(.*)$" =>  "/habari/index.php"
	)
}


After making that change and saving the file I re-started the lighttpd server process and it worked like a charm. If you are having a similar issue then I hope this helps.

Peace

No comments found. Please enter a comment if you have a question or contribution.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">