Redirecting client to single domain name.

Here is a problem where a site is hosted under different virtual hosts with different domain names.

VirtualHost1 is setup for
VirtualHost2 is setup for

And, we want to redirect to or show only domain to our clients.

Then, make some changes as below in main apache config file that is httpd.conf:

 <VirtualHost *:80>
  Redirect permanent /
<VirtualHost *:80>
 DocumentRoot /usr/local/apache/htdocs

Redirect Link to Mobile Website using .htaccess

Just add the following code in your .htaccess file

RewriteEngine on
RewriteBase /

# prevent looping
RewriteCond %{HTTP_HOST} !^$

# if the browser accepts these mime-types, it's definitely mobile, or pretending to be
RewriteCond %{HTTP_ACCEPT} "text/vnd.wap.wml|application/vnd.wap.xhtml+xml" [NC,OR]

# a bunch of user agent tests
RewriteCond %{HTTP_USER_AGENT} "sony|symbian|nokia|samsung|mobile|windows ce|epoc|opera" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "mini|nitro|j2me|midp-|cldc-|netfront|mot|up.browser||audiovox"[NC,OR]
RewriteCond %{HTTP_USER_AGENT} "blackberry|ericsson,|panasonic|philips|sanyo|sharp|sie-"[NC,OR]
RewriteCond %{HTTP_USER_AGENT} "portalmmm|blazer|avantgo|danger|palm|series60|palmsource|pocketpc"[NC,OR]
RewriteCond %{HTTP_USER_AGENT} "smartphone|rover|ipaq|au-mic,|alcatel|ericy|vodafone/|wap1.|wap2.|iPhone|android"[NC]

# rewrite rules here
RewriteRule .?{REQUEST_URI}  [L,R=302]