-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,220
  • 16
  • 58
  • 97

1 Answers1

3

Use a negation

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