Gossamer Forum
Home : General : Internet Technologies :

Rewrite rule help

Quote Reply
Rewrite rule help
Hi,

I'm looking for help with a rewrite rule to consolidate my domains and server aliases to one URL.

I have the domains qango.com and qango.co.uk.

My Apache Virtualhost has the servername as www.qango.com,
with serveraliases qango.com www.qango.co.uk qango.co.uk

How do I rewrite requests so that everything goes to www.qango.com?

Cheers,
Shaun
Quote Reply
Re: [qango] Rewrite rule help In reply to
Hi,

This may work:

Quote:
RewriteCond %{HTTP_HOST} qango.co.uk
RewriteRule /?(.*) http://www.qango.com/$1 [R=301,L]

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Rewrite rule help In reply to
Andy,

Thanks for the reply, but it doesn't seem to work.

However, after many hours of trawling about the web I found this:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.qango\.com$ [NC]
RewriteRule ^(.*)$ http://www.qango.com$1 [R=301,L]


It seems to work okay with a few test URLs I tried, but if someone could confirm it, I'd really appreciate it Smile

Cheers,
Shaun

Last edited by:

qango: Jun 28, 2007, 3:21 AM
Quote Reply
Re: [qango] Rewrite rule help In reply to
Yeah you are on right track I use exactly this to redirect mu sites for google to avoid duplicate content penalty.

RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
RewriteRule ^(.*)?$ http://www.domain.com/$1 [L,R=301]

rgrdz
Boris
Quote Reply
Re: [eupos] Rewrite rule help In reply to
Boris,

Thanks.

That's exactly what I wanted the rewrite for, to avoid any google duplicate content penalty.

Cheers,
Shaun