LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-06-2009, 12:14 PM   #1
BillKat
LQ Newbie
 
Registered: Jan 2009
Location: UK
Distribution: Red Hat Enterprise
Posts: 15

Rep: Reputation: 0
htaccess 301 rewrite


I've got a website with two domains pointing to it, pointing to the same webspace. To avoid search engine probs I'm trying to redirect the .co. to the.com, but can't seem to get any joy...
I've tried a few variations like:

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.domain\.co.uk$
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
Any help would be much appreciated....
 
Old 04-07-2009, 04:56 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
If you want to redirect the .co.uk site to the .com, then the RewriteCond should either one of the following:
Code:
RewriteCond %{HTTP_HOST} ^www\.domain\.co\.uk$
Code:
RewriteCond %{HTTP_HOST} !^www\.domain\.com$

Last edited by bathory; 04-07-2009 at 04:39 PM.
 
Old 04-07-2009, 12:54 PM   #3
BillKat
LQ Newbie
 
Registered: Jan 2009
Location: UK
Distribution: Red Hat Enterprise
Posts: 15

Original Poster
Rep: Reputation: 0
Thanks for that, not getting any effect with either of those. Think I'll ask the host support if they have any ideas.
With other attempts I either got an endless loop or nothing, so seemed like the file was having some effect, just not the desired ones...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Skytone RST-301 oddiofile Linux - Hardware 1 08-25-2008 02:59 PM
Ubuntu + GPRS Easy Connect 301 No_Guts_No_Glory Ubuntu 0 11-01-2007 10:19 AM
Apache2 mod vhost_alias - problems with .htaccess mod rewrite d_t_baker Linux - Server 1 08-16-2007 07:32 PM
cannot get 301 redirect to function geoman Linux - General 4 01-17-2006 08:23 PM
Wireless: Netgear MA 301 and MA401 Wientanz Linux - Wireless Networking 0 04-23-2003 02:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration