.htaccess redirect based on requested domain
April 28th, 2008Imagine 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.
Was this post useful to you? Let me know, buy me a beer!
Alternatively, if you're feeling impecunious, you may like to subscribe to my RSS feed, or see other articles in the Apache, Domains, Geekery, Linux category.