Web Servers on Unix and Linux - RewriteRule - criteria for being applied??

This is Interesting: Free IT Magazines  
Home > Archive > Web Servers on Unix and Linux > May 2005 > RewriteRule - criteria for being applied??





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author RewriteRule - criteria for being applied??
Brian Huether

2005-05-30, 8:47 pm

I am very confused by Rewrite Rule.

Consider this url:

http://mysite/PNphpBB2-viewforum+f-...7a1cc94bd1.html

Now, here are entries in .htaccess:

RewriteRule ^([^\+]+)-([^-]+)-([^-]*)-([a-zA-Z0-9_]*).html$
index.php?module=$1&func=$2&$3=$4 [L]

RewriteRule ^([^-]+)-([^-]+)\+([^-]+)-([^-]+)\+([^-]+)-([^-]+).html$
index.php?name=$1&file=$2&$3=$4&$5=$6 [L]

I have confirmed that the 1st rule is getting applied because if I remove
it, the rewrite works fine (i.e. the 2nd rule works, but the presence of the
1st one screws things up!).

Can someone please explain why this is happening? I thought a rule would
only get applied if the structure of the url was fitting.?? The first rule
does not have the structure of the above url!!

thanks,

brian


JP. Baker

2005-05-31, 7:47 am

In article <9OqdnYtvjdKw9AbfRVn-sg@comcast.com>,
Brian Huether <bhuetherNO@comcastSPAM.net> wrote:
>I am very confused by Rewrite Rule.
>
>Consider this url:
>
>http://mysite/PNphpBB2-viewforum+f-...7a1cc94bd1.html
>
>Now, here are entries in .htaccess:
>
>RewriteRule ^([^\+]+)-([^-]+)-([^-]*)-([a-zA-Z0-9_]*).html$


Matches as:
(PNphpBB2)-(viewforum+f)-(10+sid)-(da334d71b15efff1a84eee7a1cc94bd1).html

>RewriteRule ^([^-]+)-([^-]+)\+([^-]+)-([^-]+)\+([^-]+)-([^-]+).html$


Matches as:
(PNphpBB2)-(viewforum)+(f)-(10)+(sid)-(da334d71b15efff1a84eee7a1cc94bd1).html

>I have confirmed that the 1st rule is getting applied because if I remove
>it, the rewrite works fine (i.e. the 2nd rule works, but the presence of the
>1st one screws things up!).
>
>Can someone please explain why this is happening? I thought a rule would
>only get applied if the structure of the url was fitting.?? The first rule
>does not have the structure of the above url!!


Try using a RewriteLog.

--
John P Baker
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com