Hi group

I have a need to rewrite domains and urls based on specific rules but I can't figure out the "correct" way to do it using mod_rewrite.

What I have and what I want:
http://www.domain1.dk/          > http://www.newdomain.dk/
http://www.domain2.dk/          > http://www.newdomain.dk/
http://www.domain3.dk/          > http://www.newdomain.dk/
http://www.domain1.dk/Something > http://old.domain1.dk/Something
http://www.domain2.dk/Something > http://old.domain2.dk/Something
http://www.domain3.dk/Something > http://old.domain3.dk/Something

My initial idea was something like this:

RewriteRule ^http\://www\.(domain1|domain2|domain3)\.dk/$ http://www.newdomain.dk/ RewriteRule ^http\://www\.(domain1|domain2|domain3)\.dk/(.+)$ http://old.$1.dk/$2

But now I understand that RewriteRule works with the URL part of the complete request so I can't match the domain part with RewriteRule!?

Does this mean I need to use RewriteCond %{HTTP_HOST} and create two rewrite rules for each of the above domains?

What is the smartest, fastest and most elegant way to solve this problem?

Cheers, Tommy Ipsen


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
  "   from the digest: users-digest-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to