Forum Moderators: phranque

Message Too Old, No Replies

Apache server question about permanent redirection

Can apache do 301 redirection?

         

Calum

2:15 am on Feb 15, 2004 (gmt 0)

10+ Year Member



After taking some bad advice I've noticed that my identical .co.uk and .com sites are diluting the overall impact of site PR.

They are both pointing to the same IP address. Need to redirect the .com to the .co.uk.
Have read that creating a .htccess file in my root and having it contain the following will sort this out:
Redirect 301 / http*//www.yourdomaintoforwardtohere.co.uk/

My concern is that they are hosted from the same IP address and share the same files. Will this still work? Advice greatly appreciated.

3 more details:
1. Does 301 work on a windows server?
2. Will a 301 merge/add the full PR and backlinks over?
3. Is 301 the best option here? Have heard of a 302. Plus, how about asking the DNS holder to sort it out from their side somehow?

A huge thanks to anyone who is in the know about this
Calum

bcc1234

2:44 am on Feb 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Make sure you turn one of your domains into a separate virtual host, and then set up a redirect to the other name.
Otherwise, you'll end up in a loop.

Both of them can have the same IP.
All of my sites are set up that way, and I don't seem to have any problems.
I use one vhost for domain.com and one for www.domain.com - and any request coming to the domain.com host, just redirects to the same file on www.domain.com.

It does not make a different if you use 301 or 302. I think search engines stopped caring about it some time ago, but if you have a choice then use 301.

Calum

12:20 pm on Feb 15, 2004 (gmt 0)

10+ Year Member



Thx Bcc1234

Afraid I'm not as up on how to turn one of my domains into a virtual host. Please advise. So far I've created the .htccess in the site root - so that may cause a loop...it's killed almost all the backlinks into the .com (in just 36 hours).

Is this done from my DNS host? Am desperate to remedy - hope I haven't really screwed things up permanently with the .htccess

Thanks from a desperate
Calum

jdMorgan

7:55 pm on Feb 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Calum,

The usual way to do this in .htaccess is to use mod_rewrite in your web root directory:


Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^desired_domain\.com
RewriteRule (.*) http://desired_domain.com/$1 [R=301,L]

That is, IF NOT(<desired_domain>) THEN 301 redirect to <desired_domain>.

Jim