# The request for the below is for # URI: /p/000101A/http/www.cortado.de # HTTP_REFERER: http://enjolras:8071/p/000101A/http/www.cortado.de # The Rule I want (that doesn't seem to match the cond backref in the second ReWriteCond ReWriteCond %{HTTP_REFERER} ^http://.*:8071/p/([^/]*)/([^/]*)/([^/]*) ReWriteCond %{REQUEST_URI} !/p/%1/ ReWriteRule ^/(.*) /p/%1/%2/%3/$1 [PT,L,NS] # Log output for the above (3) applying pattern '^/(.*)' to uri '/p/000101A/http/www.cortado.de' (4) RewriteCond: input='http://enjolras:8071/p/000101A/http/www.cortado.de' pattern='^http://.*:8071/p/([^/]*)/([^/]*)/([^/]*)' => matched (4) RewriteCond: input='/p/000101A/http/www.cortado.de' pattern='!/p/%1/' => matched (2) rewrite '/p/000101A/http/www.cortado.de' -> '/p/000101A/http/www.cortado.de/p/000101A/http/www.cortado.de' ############################################################################################################################################ # A hacky rule just for testing, that seems like it should be equivalent to the above, for the given URI/HTTP_REFERER combo ReWriteCond %{HTTP_REFERER} ^http://.*:8071/p/([^/]*)/([^/]*)/([^/]*) ReWriteCond %{REQUEST_URI} !/p/000101A/ ReWriteRule ^/(.*) /p/%1/%2/%3/$1 [PT,L,NS] # Log output for the above (4) RewriteCond: input='http://enjolras:8071/p/000101A/http/www.cortado.de' pattern='^http://.*:8071/p/([^/]*)/([^/]*)/([^/]*)' => matched (4) RewriteCond: input='/p/000101A/http/index.php' pattern='!/p/000101A/' => not-matched (3) applying pattern '^/(.*)' to uri '/p/000101A/http/index.php'