We help IT Professionals succeed at work.

Conditional Redirect

I have two domain names pointing to the same site.

I need to set up a permanent redirect of traffic from the second domain to index2.html, leaving the first domain going to index.html.
Watch Question

Create virtual folders or webapps.

You dont specify the web server.
Server is a Windows IIS vertual server hosted by GoDaddy.

(I see that I accidentally posted this in the Apache zone)
Top Expert 2010


If you have access to httpd.conf you could stick the following in your second <VirtualHost > block:

DirectoryIndex index2.html

else you could stick the following in your httpd.conf or a .htaccess:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain2.com [NC]
RewriteCond %{REQUEST_URI} ^/index.html [NC,OR]
RewriteCond %{REQUEST_URI} /$                        # May wish to change it to ^/$
RewriteRule .*  index2.html [R=301,L]