Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following on my .htaccess file within /var/www/html folder.

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.net [nc,or]
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com\.au [nc,or]
RewriteRule ^(.*)$$1 [R=permanent, NC, L]

I want all and requests to redirect to

This does not seem to redirect. What am I doing wrong? Thanks!

share|improve this question
If it helps, the server is on Amazon ec2 – Pasta Jan 20 '12 at 16:49
up vote 2 down vote accepted

In the past I've had trouble with spaces in the list of flags. Also, the last OR is not needed and may cause problems. Try this:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.net [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com\.au [NC]
RewriteRule ^(.*)$$1 [R=permanent,NC,L]
share|improve this answer
Thanks, but no luck with that! – Pasta Jan 20 '12 at 17:07
If you go to the other domains (.net, are the results the same as going to Are you certain .htaccess overrides are enabled with e.g. AllowOverride All? – xofer Jan 20 '12 at 17:14
I get this error on error_log, [alert] /var/www/html/.htaccess: RewriteRule: bad flag delimiters – Pasta Jan 20 '12 at 17:42
I've never seen [R=permanent] before. Only [R=301]. – Ladadadada Jan 20 '12 at 17:49
Sorry! I had spaces in mine [R=permanent, NC, L], changed to [R=permanent,NC,L]. Now it works GREAT! – Pasta Jan 20 '12 at 17:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.