1

I have been trying to put 2 seperate sites in subfoldres and use rewites to load them.

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} !^www\.udstde\.co\.uk
RewriteCond %{HTTP_HOST} test1\.udstde\.co\.uk
RewriteRule (.*) /test1/index.php [L]

RewriteCond %{HTTP_HOST} !^www\.udstde\.co\.uk
RewriteCond %{HTTP_HOST} test2\.udstde\.co\.uk
RewriteRule (.*) /test2/index.php [L]

The problem being the first one works fine but the second one doesn't.

Can anyone see where im going wrong?

Phil Jackson
  • 9,936
  • 20
  • 92
  • 127
  • You can use variables in apache Rewrite mode as [Multiple RewriteRules for single RewriteCond in .htaccess][1] [1]: http://stackoverflow.com/questions/7218164/multiple-rewriterules-for-single-rewritecond-in-htaccess/11559655#11559655 – Huseyin May 03 '13 at 20:47

2 Answers2

1

I see the problem, in your first set of conditions,

RewriteCond %{HTTP_HOST} !^www\.udstde\.co\.uk
RewriteCond %{HTTP_HOST} test1\.udstde\.co\.uk

whenever test2 comes up, above condition turns true as both conditions turn false. (i guess)

Tim Cooper
  • 144,163
  • 35
  • 302
  • 261
Ravi Bhatt
  • 3,095
  • 17
  • 20
0
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} !^www\.udstde\.co\.uk
RewriteCond %{HTTP_HOST} ^([a-z0-9-]+).udstde\.co\.uk [NC]
RewriteRule (.*) %1/$1 [L]
Phil Jackson
  • 9,936
  • 20
  • 92
  • 127