-2

I have some rules as follows:

RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L]

I would like to make the rewrite condition match ANY domain OTHER than the domain www.domain.com . How can I do this without explicitly make a RewriteCond for each case?

tacos_tacos_tacos
  • 3,250
  • 18
  • 63
  • 100

1 Answers1

3

Use a negation

RewriteCond %{HTTP_HOST} !^www\.domain\.com$
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L]
Florin Asăvoaie
  • 7,057
  • 23
  • 35