olli460 Posted September 21, 2009 Share Posted September 21, 2009 Hi, Im new to using mod_rewrite. Ive got two simalar rules and i can't get them both working, Only the one that is above the other one works. RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?page=$1&type=$2 [NC] RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?page=$1&login=$2 [NC] What can i do? Link to comment https://forums.phpfreaks.com/topic/174976-mod_rewrite-simalar-rules-how/ Share on other sites More sharing options...
Bricktop Posted September 21, 2009 Share Posted September 21, 2009 Hi ollie460, Put an "L" at the end of each rule, i.e.: RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?page=$1&type=$2 [NC, L] RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?page=$1&login=$2 [NC, L] The "L" stands for "Last Rule" and basically won't process any further rewrite rules. Hope this helps. Link to comment https://forums.phpfreaks.com/topic/174976-mod_rewrite-simalar-rules-how/#findComment-922174 Share on other sites More sharing options...
olli460 Posted September 21, 2009 Author Share Posted September 21, 2009 Hello, I tried adding L to both of them but only the top one works still. index.php?page=upload&type=ea --- > /upload/ea index.php?page=login&login=complete --- > /login/complete Thats what i want it to do, If i swap them around the top one will work and the other wont. Link to comment https://forums.phpfreaks.com/topic/174976-mod_rewrite-simalar-rules-how/#findComment-922177 Share on other sites More sharing options...
Bricktop Posted September 21, 2009 Share Posted September 21, 2009 Hi olli460, You might be better off asking your question in the mod_rewrite forum at http://www.phpfreaks.com/forums/index.php/board,50.0.html. Link to comment https://forums.phpfreaks.com/topic/174976-mod_rewrite-simalar-rules-how/#findComment-922180 Share on other sites More sharing options...
ozestretch Posted September 21, 2009 Share Posted September 21, 2009 How does your rule know to differentiate between which querystring is required (login or type) I am not great with rewrites, but seems it will only ever take the first one. With that rule anyways Not sure wqhat rule you need though :-\ Link to comment https://forums.phpfreaks.com/topic/174976-mod_rewrite-simalar-rules-how/#findComment-922181 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.