Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: Two domains & multiple subdomains Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Sylvie
Newbie
Newbie


Joined: 16 June 2010
Online Status: Offline
Posts: 12
Posted: 16 June 2010 at 8:27am | IP Logged Quote Sylvie

Hello,
(sorry for my english !)

With ISAPI_rewrite 2.x

I have 2 domains :
site1 in IIS root
site2 in an other folder

In httpd.ini, i have :

  RewriteCond Host: www.(.*)\.site1.com
  RewriteRule (.*) /page/$1$2 [I,L]

So, www.subdom1.site1.com displays the contents of www.site1.com/page/subdom1

It's OK, that works fine.

Now, I want the same thing for site2.com.
RewriteCond Host: www.(.*)\.site2.com
  RewriteRule (.*) /page/$1$2 [I,L]

But it doesn't work.
www.subdom2.site2.com => error 404

I try :
RewriteRule .* http\://www\.site2\.com/page/$1 [I,L]
but it doesn't work too

I think it's because site1 is on the root and the rule for site2 works on the site1's folder.

An idea? I need help! Thanks a lot

Sylvie

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


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10489
Posted: 16 June 2010 at 9:20am | IP Logged Quote Anton

Please try to fix the rules for site2 as follows:

RewriteCond Host: www.(.*)\.site2.com
RewriteRule (.*) /other_folder/page/$1$2 [I,L]

Where other_folder is the folder where site2 is located.

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


Joined: 16 June 2010
Online Status: Offline
Posts: 12
Posted: 16 June 2010 at 9:42am | IP Logged Quote Sylvie

Thanks Anton,

It doesn't work.

I think my problem is in my configuration. I think I am wrong somewhere

For my two dns :

* A 91.121.27.64
*        A   my.ip.0.0
@       A   my.ip.0.0
www   A   my.ip.0.0

On IIS :
Web site site1.com directory c:\clients\site1 
my.ip.0.0    port 80    * (empty)
my.ip.0.0    port 80    site1.com
my.ip.0.0    port 80    www.site1.com

Web site site2.com directory c:\clients\site2 
my.ip.0.0    port 80    site2.com
my.ip.0.0    port 80    www.site2.com

I think the problem is here because subdom.site2.com is going to site1 directory, no?

What I have to do for something good?

Thank you very much.

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


Joined: 16 June 2010
Online Status: Offline
Posts: 12
Posted: 16 June 2010 at 9:50am | IP Logged Quote Sylvie

Sylvie wrote:

Thanks Anton,

It doesn't work.

I think my problem is in my configuration. I think I am wrong somewhere

For my two dns :

*        A   my.ip.0.0
@       A   my.ip.0.0
www   A   my.ip.0.0

On IIS :
Web site site1.com directory c:\clients\site1 
my.ip.0.0    port 80    * (empty)
my.ip.0.0    port 80    site1.com
my.ip.0.0    port 80    www.site1.com

Web site site2.com directory c:\clients\site2 
my.ip.0.0    port 80    site2.com
my.ip.0.0    port 80    www.site2.com

I think the problem is here because subdom.site2.com is going to site1 directory, no?

What I have to do for something good?

Thank you very much.

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


Joined: 16 June 2010
Online Status: Offline
Posts: 12
Posted: 17 June 2010 at 3:13am | IP Logged Quote Sylvie

Hello Anton,

any idea to help me? Please.

Thanks

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


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10489
Posted: 17 June 2010 at 4:00am | IP Logged Quote Anton

You should have a * mapping for site1 and use the rules I provided above.

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


Joined: 16 June 2010
Online Status: Offline
Posts: 12
Posted: 17 June 2010 at 6:36am | IP Logged Quote Sylvie

Thanks, but...

With :
RewriteCond Host: www.(.*)\.site2.com
RewriteRule (.*) /other_folder/page/$1$2 [I,L]

That works if 'other_folder' is in site1 folder. But, Web site site1.com is in c:\clients\site1  directory and site2.com is in c:\clients\site2  and site1 & site2 must be in different folder.

Why it's not possible to do :
RewriteCond Host: www.(.*)\.site2.com
RewriteRule .* http\://www\.site2\.com/page/$1 [I,L]
(with R, it works but I want have subdom2.site2.com in URL)

I hope it's clear.

I have a * mapping for site1 AND site2. Is that right?

Thanks for your patience !

 


 

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


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10489
Posted: 17 June 2010 at 7:39am | IP Logged Quote Anton

Please try to fix your rule for site2 as follows:

RewriteCond Host: www\.(.*)\.site2\.com
RewriteRule .* http\://www\.site2\.com/page/$1 [I,P]

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


Joined: 16 June 2010
Online Status: Offline
Posts: 12
Posted: 17 June 2010 at 7:59am | IP Logged Quote Sylvie

Sorry but it doesn't work.
It's strange.
If I type www.subdom2.site2.com, it doesn't work (error 404)
If I type www.subdom2.site2.com/page/suddom1(from site1), displays the contents of www.site1.com/page/subdom1
But www.subdom1(from site1).site2.com dispalys error 404

If I replace P by R, the redirection to www.site2.com/page/subdom2 is OK.

It's really a puzzle!

Thanks for your help.

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


Joined: 16 June 2010
Online Status: Offline
Posts: 12
Posted: 17 June 2010 at 8:08am | IP Logged Quote Sylvie

Correction :

Sorry, If I type www.subdom2.site2.com, it's not an 404 error but it displays homepage from site1.com.

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


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10489
Posted: 17 June 2010 at 8:50am | IP Logged Quote Anton

Are you using Full or Lite version of ISAPI_Rewrite?
And could you please explain your sites structure once again, 'cause there seems to be some misunderstanding.

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


Joined: 16 June 2010
Online Status: Offline
Posts: 12
Posted: 17 June 2010 at 9:18am | IP Logged Quote Sylvie

I'm using Lite version.

I have two sites.
On IIS:
site1.com, www.site1.com and *.site1.com point to c:\clients\site1 directory;
site2.com and www.site2.com point to c:\clients\site2 directory

Site1 is the default site. So, *.site2.com happens in site1 directory (I can not do otherwise and I think the problem comes from there).

Structure:
www.site1.com/page/subdom1
www.site2.com/page/subdom2

From now, with  
RewriteCond Host: www.(.*)\.site1.com
RewriteRule (.*) /page/$1$2 [I,L]

www.subdom1.site1.com displays the contents of www.site1.com/page/subdom1 and that works fine.

But, with your last rule
RewriteCond Host: www\.(.*)\.site2\.com
RewriteRule .* http\://www\.site2\.com/page/$1 [I,P]

www.subdom2.site2.com displays the contents of www.site1.com !

I can't find the rule that allows me www.subdom2.site2.com displays the contents of www.site2.com/page/subdom2

I hope that you find me the solution!

Sylvie

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


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10489
Posted: 18 June 2010 at 2:56am | IP Logged Quote Anton

Ok, I see.

Let's try to have the following config:

RewriteCond Host: www\.(.*)\.site1\.com
RewriteRule (.*) /page/$1$2 [I,L]

RewriteCond Host: www\.(.*)\.site2\.com
RewriteRule (.*) /page/$1$2 [I,L]

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


Joined: 16 June 2010
Online Status: Offline
Posts: 12
Posted: 18 June 2010 at 3:09am | IP Logged Quote Sylvie

If you read my first message, I have this for site1 and it works right.

But for site2, it doesn't work.

In IIS, site1 have "my.ip.0.0    port 80    * (empty)". I doesn't have un default site with "All unassigned". So, I think, all subdomains from site2 arrive in site1 folder. That's why I try to use a rule with "http://www.site2.com"etc but I don't find.

I'm apologize for being unable to better explain. I'll keep looking. Thank you for yout help.

Sylvie

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


Joined: 16 June 2010
Online Status: Offline
Posts: 12
Posted: 18 June 2010 at 3:48am | IP Logged Quote Sylvie

Hello Anton,

I advance slowly...
I changed my IIS settings.

Now:
RewriteRule (.*) http\://www\.site2\.com/page/$1$2 [I,P]
work fine.

When I type www.subdom2.site2.com, it displays the contents of www.site2.com/page/subdom2 ! Yeah !

But, of course, I have a another probleme! My pictures no longer appear !

In my pages, paths of  images are like :
src="/page/subdom2/images/alea_folder/0123.jpg".
So, when I right clik proprieties of the image, the path is:
http://www.subdom2.site2.com/page/subdom2/images/alea_folder/0123.jpg

Is there a solution to :
http://www.subdom2.site2.com/page/subdom2/images/alea_folder/0123.jpg
==>>
http://www.subdom2.site2.com/images/alea_folder/0123.jpg

(or other thing).

Thanks a lot
Sylvie

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


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10489
Posted: 18 June 2010 at 5:40am | IP Logged Quote Anton

Yes, please try to apply the following rule to fix the images:

RewriteRule /page/subdom2/(.*\.(?:gif|jpg|png)) /$1 [I,L]

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


Joined: 16 June 2010
Online Status: Offline
Posts: 12
Posted: 18 June 2010 at 7:57am | IP Logged Quote Sylvie

It doesn't work.

I try this. Is it right?
RewriteCond Host: www\.(.*)\.site2\.com
RewriteRule (.*) http\://www\.site2.com/page/$1$2 [I,P]
RewriteRule /page/subdom2/(.*\.(?:gif|jpg|png)) /$1 [I,L]

There is a thing I don't understand: a RewriteRule directive depends on the previous RewriteCond, no?
I feel "RewriteRule /page/subdom2/" works on the default web site (using All unassigned requests mapping) and not on the site2 web site folder.

My new configuration is :
On IIS, 3 web sites:
Default -> c:\inetpub\wwwroot (using All unassigned requests mapping)
Site1 -> c:\client\site1 (using xxx.xxx.my.IP for WWW)
Site2 -> c:\client\site2 (using xxx.xxx.my.IP for WWW)

Have I forgotten something?

Thanks

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


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10489
Posted: 21 June 2010 at 2:50am | IP Logged Quote Anton

Please try to fix the config like this:

RewriteCond Host: www\.(.*)\.site2\.com
RewriteRule /page/subdom2/(.*\.(?:gif|jpg|png)) /$1 [I,L]
RewriteCond Host: www\.(.*)\.site2\.com
RewriteRule (.*) http\://www\.site2.com/page/$1$2 [I,P]

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


Joined: 16 June 2010
Online Status: Offline
Posts: 12
Posted: 24 June 2010 at 3:55pm | IP Logged Quote Sylvie

Thanks Anton, Nice work!

Regards

Sylvie

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

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 cannot vote in polls in this forum