Jump to content

Using RewriteCond Backreferences more than once? Help


therealwesfoster

Recommended Posts

Here's the code:

RewriteCond %{HTTP_HOST} ^([^\.]+)\.site\.net$ [NC]
RewriteCond %1 !^(www|ftp|mail)$ [NC]

# Rule 1
RewriteRule ^([\w-]+)/view/([\w-]+)$							./$2.php?cat=%1&do=$1 [NC,L,QSA]

# Rule 2
RewriteRule ^([\w-]+)/([\w-]+)/([\d]+)/view/([\w-]+)$		./$4.php?cat=%1&do=$1&name=$2&id=$3 [NC,L,QSA]

 

The problem:

#Rule1 works fine. All the GET vars are replaces by their correct backreference.

#Rule2 however does not work. All of the $vars work, but the %var (rewritecond) doesn't work. Now if I flip Rule1 and Rule2 around, then Rule 2 will work, and not rule1. So it's like the %var gets erased after the first RewriteRule is scanned through.

 

Help please!

 

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.