This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 3.0
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: Rewrite issue domain1 to domain2 Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
timsw
Newbie
Newbie


Joined: 04 August 2010
Location: United States
Online Status: Offline
Posts: 5
Posted: 04 August 2010 at 11:07am | IP Logged Quote timsw

I am trying to rewrite the following:

RewriteCond %{HTTP:Host} ^www\.domain1\.com\/volunteer/?$

RewriteRule (.*) http\://volunteer.domain2.com/ [NC,L,R=301]

I have another rule that is a catchall rule as follows:

RewriteCond %{HTTP:Host} ^www\.domain1\.com$

RewriteRule (.*) http\://www\.domain2\.com/fair/home.aspx [NC,L,R=301]

The problem that I am having is everything gets rewritten based on the second rule and not the first.  What am I doing wrong.  Thank you for your assistance.

Tim



Edited by timsw - 04 August 2010 at 11:08am
Back to Top View timsw's Profile Search for other posts by timsw
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 05 August 2010 at 2:37am | IP Logged Quote Anton

Here's the correct syntax for you:

RewriteBase /

RewriteCond %{HTTP:Host} ^www\.domain1\.com$
RewriteRule ^volunteer.*$ http://volunteer.domain2.com/ [NC,L,R=301]

RewriteCond %{HTTP:Host} ^www\.domain1\.com$
RewriteRule .? http://www.domain2.com/fair/home.aspx [NC,L,R=301]

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
timsw
Newbie
Newbie


Joined: 04 August 2010
Location: United States
Online Status: Offline
Posts: 5
Posted: 05 August 2010 at 10:28am | IP Logged Quote timsw

Thank you Anton.  This worked perfectly.  Much appreciated.

Tim

Back to Top View timsw's Profile Search for other posts by timsw
 
timsw
Newbie
Newbie


Joined: 04 August 2010
Location: United States
Online Status: Offline
Posts: 5
Posted: 05 August 2010 at 3:46pm | IP Logged Quote timsw

Anton,

I spoke to soon.  The syntax you gave indeed works but by adding the slash after RewriteBase it broke all my other general rules.  I have provided a couple of samples of the rules the slash breaks. 

RewriteRule ^/coffeetea(.*)$ /shopping/browse.aspx?subject=MCF [NC,L,R=301]

RewriteRule ^/detail.aspx(.*)$ /shopping/detail.aspx$1 [NC,L,R=301]

Can you tell me what the slash after RewriteBase does?  Thank you again for all the assistance.

Tim

Back to Top View timsw's Profile Search for other posts by timsw
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 06 August 2010 at 2:33am | IP Logged Quote Anton

Sorry, I didn't know you have another rules.
You may do without RewriteBase.
Then the above rules will be:

RewriteCond %{HTTP:Host} ^www\.domain1\.com$
RewriteRule ^/volunteer.*$ http://volunteer.domain2.com/ [NC,L,R=301]

RewriteCond %{HTTP:Host} ^www\.domain1\.com$
RewriteRule .? http://www.domain2.com/fair/home.aspx [NC,L,R=301]

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You can vote in polls in this forum