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 / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Mod rewrite rule going wrong, for some reason.
loads wrong variable, and I'm tearing my hair out.

10+ Year Member

Msg#: 1339 posted 10:33 am on Apr 5, 2004 (gmt 0)

I have a php function that goes something like this:

replace (?<!/)viewtopic.php\?forum=([0-9]*)&thread=([0-9*]) with forum\\1/thread\\2.htm, which correctly changes the URLs to the forum[0-9]/thread[0-9].htm format, as expected.

I then have a rewrite rule that looks like this:
RewriteRule ^forum([0-9]*)/thread([0-9]*).htm viewtopic.php?forum=$1&thread=$2 which should, to my mind, use forum[0-9] to equal forum=[0-9] and ditto for thread. However, it doesn't. Instead of forwarding to the thread (via the thread= variable) it just loads the forum (via the forum= var) in the rewritten URL. I've checked the query string itself, and forum=1&thread=2 (for example) definately exists and points to a generated thread, so I can only assume that there is somethign wrong with my rewrite rule, only I can't see it :)

Can anyone help explain why it might do this?



10+ Year Member

Msg#: 1339 posted 10:37 am on Apr 5, 2004 (gmt 0)

Right, well, nevermind. Dismiss this post, I've realised the rewrite rule worked, it was just conflicting with another one (RewriteRule ^forum([0-9]*).* viewforum.php?forum=$1 for reference's sake). So hurrah.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
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