Jump to content

[SOLVED] Question about RewriteCond


therealwesfoster

Recommended Posts

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.