Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

Q1. is it possible to further optimize / compact the following rules, thereby making the entire redirections faster and easier to maintain in future? There are about twenty of these domains!! you get the picture of my problem! Thanks very much for any and all clues +1

RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^$ en/home [R=301]
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^$ de/home [R=301]
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^$ fr/home [R=301]

etc etc etc
Q2. should I chain these rules like putting [C] at end or ??

Q3. is this the proper fashion of redirecting from search engine point of view?

share|improve this question
up vote 1 down vote accepted

With regards to Q1, the only way I can think of making it a bit more compact is to make part of your on-disk path to the sites reflect the url - that way you can probably get away with a handful of rules just to take the domain suffix and apply it to the path.

For Q2, I'd say it looks fine, although I'd add ,L to the [R=301], so it reads [R=301,L] - that'll stop mod_rewrite from going any further once it's found a match.

Lastly, for Q3 I think you're spot on with 301 - Google recommend using 301 Redirects, as this document on their site says.

Hope that helps!

share|improve this answer
Thanks Andy! all my questions are answered, the Fourth Question i have put in a separate page, as its about COMBINING multiple domains that all go to the same page, unlike the nature of this question where they are all spread,… – Sam Dec 19 '10 at 17:29

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.