Domain Name Redirects

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 2
Joined: 11 Sep 2013, 16:51

Domain Name Redirects

11 Sep 2013, 16:54

Hello,
We are wanting to do something similar to this:
http://www.helicontech.com/forum/11901- ... older.html

We would like the root domain of ABC.com to redirect to 123.com, and have all other pages (except for 123.com and http://www.123.com/) redirect to XYZ.com. All of the website content was moved from ABC.com to XYZ.com, but the root domain (home page) should still go to 123.com.

Is this possible without having to manually define all of the specific exceptions for new content on XYZ.com? The overall configuration settings in our .htaccess file are listed below. Any assistance in this would be greatly appreciated. Thank you.

# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.87

# unsupported directive: [ISAPI_Rewrite]
# 3600 = 1 hour
# unsupported directive: CacheClockRate 3600
# Block external access to the httpd.ini and httpd.parse.errors pages
RewriteRule ^/httpd(?:\.ini|\.parse\.errors).*$ [F,I,O]
# Block xml file access
# RewriteRule [^\.]*\.xml [F,I,O]
# Block external access to the Helper ISAPI Extension
RewriteRule ^.*\.isrwhlp$ [F,I,O]

thanks,
droid01

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

Re: Domain Name Redirects

11 Sep 2013, 21:16

Hello,

I'll try to fit it in as few rules as possible:

Code: Select all
RewriteEngine on
RewriteBase /

RewriteCond %{HTTP:Host} ^(?:www\.)?abc\.com$ [OR]
RewriteCond %{HTTP:Host} ^(?:www\.)?123\.com$
RewriteRule .+ http://XYZ.com [NC,R=301,L]

RewriteCond %{HTTP:Host} ^(?:www\.)?abc\.com$
RewriteRule ^$ http://123.com [NC,R=301,L]


This should be located in global httpd.conf.

Regards
Andrew

User avatar
Posts: 2
Joined: 11 Sep 2013, 16:51

Re: Domain Name Redirects

13 Sep 2013, 15:00

Hi Andrew,
Thank you for the quick response on this. We actually use a .htaccess file and not a global httpd.conf. The .htaccess is where all of our rewrite rules and redirects are placed. Will we need to make a separate httpd.conf, or should they go in the .htaccess?

thanks again,
droid01

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

Re: Domain Name Redirects

15 Sep 2013, 22:00

You can use these rules in separate .htaccess files:

to abc's .htaccess
Code: Select all
RewriteEngine on
RewriteRule .+ http://XYZ.com [NC,R=301,L]

RewriteRule ^$ http://123.com [NC,R=301,L]


to 123's .htaccess
Code: Select all
RewriteEngine on
RewriteRule .+ http://XYZ.com [NC,R=301,L]


Regards
Andrew

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 19 guests