homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

Assist with rewrite condition rules - I'm almost there - but...

5+ Year Member

Msg#: 3849097 posted 9:27 pm on Feb 13, 2009 (gmt 0)

I've spent the last couple of days reviewing the lighttpd modrewrite docs and any number of writeups, tutorials and examples on the web, but I can't quite wrap my rewrite issue up.

I am running Joomla 1.5.9 and the latest PHPBB3, and I'm bridging the two using ROKBRIDGE - with no SEO enabled.

This domain is one of about six domains running on an LXLABS virtual server & LXADMIN Control Panel. I am making the rewrite entry in the lighttpd.mysite.conf file.

Joomla urls work fine
PHPBB3 urls work fine

I hit a snag when a user receives an email from the system - whether its a password reset, PM notification, or notification of a post made in a subscribed topic. The links are incorrect and they throw a 404. Below are some of the links I'm having issues with:

(I've broken the links deliberately this post with the dashes)

(I'm not sure which of the last two is valid to I've written the rewrite condition to match either.)

Here is what they need to look like:


I've been successful in getting the above to work using this code:

url.rewrite-once = ( "forum/([a-z]+)\.php\?{0,1}(.*)" => "forum/index.php?$2&rb_v=$1" )

But, here's the hitch - that [a-z] string also matches the valid urls when a user is in the forum so they get rewritten and a 404 is thrown.
The url below is also not rewriting properly.

This >http://mysite.com/forum/viewtopic.php?f=2&t=17&p=30&e=30
Needs to be >http://mysite.com/forum/index.php?f=2&t=17&p=30&e=30&rb_v=viewtopic
But this is what I get >http://mysite.com/forum/index.php?f=2&t=17&rb_v=viewtopic&p=30#p30

Is there a limitation in (.*) ?

In place of [a-z] - I've tried [^index]. It fixes the links within the forum, but the links I'm trying to rewrite are broken again.

Can anybody offer any insight into where I'm going wrong? I have absolutely zero experience with rewrites or regex so I'm really at a dead-end until I figure out what "the right question" is to ask the almighty google-god.

[edited by: ToneDef at 9:28 pm (utc) on Feb. 13, 2009]



5+ Year Member

Msg#: 3849097 posted 3:22 am on Feb 14, 2009 (gmt 0)

Well, it helps significantly if I execute a "url.rewrite" as opposed to a "mod.rewrite"

I also added a second rule to pass urls containing "index.php" through unmangled. All is well.

Here's the code:

url.rewrite-once = ( "forum/index.php\?(.*)" => "$0",
"forum/([a-z]*).php\?(.*)" => "forum/index.php?$2&rb_v=$1" )

With that done, is there a better way to write this rule to make it more efficent?

[edited by: ToneDef at 3:29 am (utc) on Feb. 14, 2009]

Global Options:
 top home search open messages active posts  

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved