Exoon Posted February 27, 2009 Share Posted February 27, 2009 Hello, ive got these two rules and they work fine when there on their own but as soon as i put them together only the one at the top works. How can i have both these rules? RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /index.php?page=$1&id=$2& [L,NC] RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /index.php?page=$1&console=$2& [L,NC] Link to comment https://forums.phpfreaks.com/topic/147147-why-dont-these-work-when-together/ Share on other sites More sharing options...
rhodesa Posted February 27, 2009 Share Posted February 27, 2009 I don't see a difference in the REGEX? There has to be SOME difference Link to comment https://forums.phpfreaks.com/topic/147147-why-dont-these-work-when-together/#findComment-772505 Share on other sites More sharing options...
Exoon Posted February 27, 2009 Author Share Posted February 27, 2009 the difference is one is using id and one is using console. I want it so its like index.php?page=reviews&id=7 goes to >> /reviews/7/ index.php?page=games-list&console=ps3 goes to >> /games-list/ps3/ but only one of them works. How can i get both working? Link to comment https://forums.phpfreaks.com/topic/147147-why-dont-these-work-when-together/#findComment-772793 Share on other sites More sharing options...
rhodesa Posted February 27, 2009 Share Posted February 27, 2009 that isn't how it works though, it's the other way around: /reviews/7/ goes to >> index.php?page=reviews&id=7 /games-list/ps3/ goes to >> index.php?page=games-list&console=ps3 that being said, both the first and second examples will match the first REGEX. i would switch it to something more generic, like this: RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /index.php?page=$1&topic=$2& [L,NC] then adjust your reviews code to map $_GET['topic'] to the id and your games-list code to map $_GET['topic'] to the console Link to comment https://forums.phpfreaks.com/topic/147147-why-dont-these-work-when-together/#findComment-772801 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.