views:

268

answers:

2

I'm hosting on MediaTemple.

I would like www.rhapsodicmusic.com to redirect to www.rhapsodicmusic.co.uk so that www.rhapsodicmusic.com/anypageordirectory will go to www.rhapsodicmusic.co.uk/anypageordirectory.

I have the following code in my .htaccess

RewriteEngine On

RewriteBase /
RewriteCond %{HTTP_HOST} ^([^.:]+\.)*rhapsodicmusic\.com\.?(:[0-9]*)?$ [NC]
RewriteRule ^(.*)$ http://www.rhapsodicmusic.co.uk/$1 [R=301,L]

However, this redirect rule sends everything at rhapsodicmusic.com to rhapsodicmusic.co.uk/html e.g. rhapsodicmusic.com/test.html goes to rhapsodicmusic.co.uk/html/test.html...

The directory structure is:

domains/
|- rhapsodicmusic.com/
|- |- cgi-bin/
|- |- html/
|- |- .htaccess
|- rhapsodicmusic.co.uk/
|- |- cgi-bin/
|- |- html/
|- |- |- index.html
|- |- |- about.html
|- |- |- etc...

How do I stop it redirecting to that (non-existent) html directory?

A: 

Try this rule:

RewriteCond %{HTTP_HOST} ^(www\.)?rhapsodicmusic\.com$ [NC]
RewriteRule ^ http://www.rhapsodicmusic.co.uk%{REQUEST_URI} [R=301,L]
Gumbo
A: 

Thanks Gumbo, what I just got working was this:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)$ http://www.rhapsodicmusic.co.uk%{REQUEST_URI} [L,R=301]

And that seems to work fine...

Jon