AdRock Posted August 31, 2006 Share Posted August 31, 2006 It seems to me that 2 of my rewrite rules are conflictingRewriteRule ^([A-Za-z0-9]+)/([0-9]+)/?$ index.php?page=$1&id=$2RewriteRule ^([A-Za-z0-9]+)/([0-9]+)/?$ index.php?page=$1&pagenum=$2The first rule will work but the second rule won't. If i reverse the rules the bottom one will work and the top one doesn't.How do i sort it out so both rules work? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted August 31, 2006 Share Posted August 31, 2006 Its becuase your expressions are exactly the same. You need to change the rewrite slightly so the expressions are unique. Such as for your secound rewrite rule have this as the url format:mysite.com/pagename/page{pageNumberHere}Where {pageNumberHere} is it'll be a number, eg:mysite.com/pagename/page1So use this as the rewrite rule for your secound expression:RewriteRule ^([A-Za-z0-9]+)/page([0-9]+)/?$ index.php?page=$1&pagenum=$2Now both expressions are unique Apache is able work out with expression to use, whereas before they where the same and apache couldn't see the difference between the two expressions. Quote Link to comment Share on other sites More sharing options...
AdRock Posted September 1, 2006 Author Share Posted September 1, 2006 I think i understand why it doesn't work.Is it to do with this bit [b]RewriteRule ^([A-Za-z0-9]+)/([0-9]+)/?$[/b] becuase they are both the same?Could I rewrite this[code]RewriteRule ^([A-Za-z0-9]+)/([0-9]+)/?$ index.php?page=$1&id=$2[/code]to this[code]RewriteRule ^([A-Za-z0-9]+)/image/([0-9]+)/?$ index.php?page=$1&id=$2[/code]What I would like is a url like this[b]mysite.com/gallery/image/1[/b] Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 1, 2006 Share Posted September 1, 2006 yes that should work Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.