redirecting with .htaccess

Soldato
Joined
15 Feb 2003
Posts
10,172
Location
Europe
I want to redirect an entire domain/site domain www.mydomain.co.uk to a completely different site e.g www.myotherdomain.com/index

I tired adding a 301 redirect to the .htaccess file but i get an internal server error.

Normally i would do this using the control pannel on the hosting/regestrar, doesn't offer any forwarding options or anything unless you upgrade your package.

hosting is with donhost and the domain with fasthosts.

p.s i didn't buy these personally, been roped into it at work.
 
Try something like:

Code:
RewriteEngine On
RewriteRule (.*) http://www.domain.co.uk/$1 [R=301,L]

where domain.co.uk is the second URL to want to redirect to.
 
As a follow on - I don't think you need the /public_html bit as thats the default location, so you could try what you have without that bit, just put it as a slash.
 
I have yet more problems with .htaccess and redirecting. i am trying to permantly redirect a site that is on a linux/unix server so my .htaccess looks like this;

Code:
redirectMatch 301 ^(.*)$ http://www.angliantrailers.co.uk/refrigeratedtrailers.html
redirectMatch permanent ^(.*)$ http://www.angliantrailers.co.uk/refrigeratedtrailers.html

When visiting the old site i get the following:

Internal Server Error, this is an error with your script, check your error log for more information.

Any ideas?
 
Back
Top Bottom