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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.