views:

12

answers:

1

Is there a way to refactor this to use the same rule? I have a production site and a staging test site.

test site

RewriteCond %{HTTP_HOST} ^test.example.com$

RewriteCond %{REQUEST_URI} admin

RewriteRule ^(.*)$ test-admin.blurb.com$1 [L]

production site

RewriteCond %{HTTP_HOST} ^www.example.com$

RewriteCond %{REQUEST_URI} admin

RewriteRule ^(.*)$ admin.example.com$1 [L]

A: 

It is possible but I think you don’t want something like this:

RewriteCond %{HTTP_HOST} =test.example.com
RewriteCond test-admin.blurb.com .+ [OR]
RewriteCond %{HTTP_HOST} =www.example.com
RewriteCond admin.example.com .+
RewriteRule admin http://%0%{REQUEST_URI}
Gumbo