therealwesfoster Posted December 5, 2008 Share Posted December 5, 2008 Here's the code: ### Cond: Has cat set (subdomain). Contains online/viewing RewriteCond %{HTTP_HOST} ^([^\.]+)\.site\.net$ [NC] # Extract the subdomain part of site.net RewriteCond %1 !^(www|ftp|mail)$ [NC] # Check that the subdomain part is not www, ftp or mail RewriteCond %{REQUEST_URI} (online)\/(viewing) [NC] # Contains ONLINE/VIEWING # Cat RewriteRule ^online/viewing/([\w-]+)$ ./$1.php?cat=%1 [NC,L,QSA] Here is my question. Why is it that the Condition vars (%) are like so: %0 = online/viewing %1 = online %2 = viewing Shouldn't %1 be the category, %2 be "online" etc.? Why is the first RewriteCond not saved in the %variables? Note: I have solved this myself (before posting this topic) by just switching the 2 RewriteConds around (which allows %1 to be the category). My question isn't "how do I fix this?", it is simply "why does %1 not equal the category?" Thanks! Wes Quote Link to comment https://forums.phpfreaks.com/topic/135597-solved-question-about-rewritecond/ Share on other sites More sharing options...
therealwesfoster Posted December 5, 2008 Author Share Posted December 5, 2008 Ok, problem solved. You can only use the last RewriteCond's backreferences This topic may help someone else Wes Quote Link to comment https://forums.phpfreaks.com/topic/135597-solved-question-about-rewritecond/#findComment-707120 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.