kieranbarnes Independent PHP, WordPress & CubeCart Programmer

.htaccess redirect based on requested domain

Posted on April 28, 2008

Imagine you have a selection of domain names that point to the same site, are some of those domains specific to certain areas of your site?

Here's how I redirect a domain name to a specific area on a site

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www.)?cubecartexperts.co.uk
Rewriterule ^(.*)$ http://www.i9000networks.com/landing-page/cubecart-experts/ [L]

You'll also need the domain set in your virtualhost config like this

ServerName www.i9000networks.com
ServerAlias www.cubecartexperts.co.uk
ServerAlias cubecartexperts.co.uk

It is a much more helpful way of helping your users navigate your site.


Related posts

  1. Redirect a www prefixed site to a non-www prefix
    I like clean URLs. Add this to your .htaccess in the site root RewriteEngine on...
  2. Apache redirects based on IP Address/Subnet
    Ever needed to redirect a source IP address or source subnet in apache? Why? Redirect...
  3. New domains
    I've just managed to snap up two super new domain names, can't believe they haven't...
  4. Synchronizing time on a Windows 2003 domain controller
    In a Windows domain environment its incredibly important that all clients & servers share the...
  5. [Snippet] Forcing Replication Between Domain Controllers
    ...because some people still don't know! Open Active Directory Sites and Services. In the console...

Tagged as: Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.