Redirect domain2.com to domain1.com/pagename.php

Helicon Ape provides support for Apache .htacces and .htpasswd configuration files for Microsoft IIS.
User avatar
Posts: 23
Joined: 10 Oct 2012, 16:22

Redirect domain2.com to domain1.com/pagename.php

27 Jun 2014, 17:22

Hello all,

I am having a real issue and hope someone can guide me!

Using Helicon Ape on Win2k8 R2 IIS7.5

We have a main domain website (domain1.com) and also have a second domain (domain2.com) as an alias, however what we would like to do is redirect domain2.com to a page on domain1.com, so:

http://www.domain2.com redirect to http://www.domain1.com/pagename.php

We have tried a number of redirects but nothing seems to work! If we enter domain2.com it simply goes to domain1.com.

We are currently trying:

Code: Select all
RewriteCond %{HTTP_HOST} ^domain2.com$
RewriteRule ^$ http://www.domain1.com/pagename.php [L,R=301]


Just to add to this, there is the following already in the htaccess file for the main domain1.com which we do not want to change if we can help it:

Code: Select all
Options +FollowSymlinks
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http://www.%1%2 [R=301,L]


Any guidance would be very much appreciated!

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Redirect domain2.com to domain1.com/pagename.php

30 Jun 2014, 15:35

Hello,

I'd try using:

Code: Select all
RewriteCond %{HTTP:Host} ^domain2\.com$ [NC]
RewriteRule ^/?$ http://www.domain1.com/pagename.php [NC,R=301,L]


and put it ABOVE the rule that you already have. The first rule seems to be a more generic and catches your request before anything else.

Regards

Return to Helicon Ape

Who is online

Users browsing this forum: No registered users and 4 guests