This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: Rewrites for a domain in a subfolder
Author
Message |
saefren
Newbie


Joined: 11 October 2010
Location: Netherlands
Posts: 10
Posted: 01 June 2011 at 11:02am

The title may be a bit confusing so let me explain. I am
hosting 2 websites at www.yourhosting.nl and they're
reluctant to supply me with the right information or a
good example. In reality it is just 1 website and another
in a sub-folder of the first. Using ISAPI rewrite (and I
guess a virtual directory in IIS) the second website
works as if it stands alone.

So, there is www.mainsite.com and www.subsite.com. The
root path for mainsite is /home/html and the subsite is
located in /home/html/subsite.com.

There is a /home/html/httpd.ini which contains the
following rules:

RewriteCond %SERVER_NAME ^www\.subsite\.com$
RewriteRule (.*)        /subsite.com$1 [I,L]

RewriteCond %SERVER_NAME ^subsite\.com$
RewriteRule (.*)        /subsite.com$1 [I,L]

Now I wish to write a rule for this subsite, let's say
www.subsite.com/home -> www.subsite.com/home.aspx

Normally, this wouldn't be a problem. I guess I would use
something like this:

RewriteRule ^/home$        /home.aspx        [I ]


I tried such a rule in /home/html/subsite.com/httpd.ini
but it does not work. It seems to me this has something
to do with the site being in a sub-folder. So I tried to
add the following rule in /home/html/httpd.ini:

RewriteRule ^www\.mainsite\.com/home$   
/mainsite.com/home.aspx   [I ]

Which doesn't work, it's probably wrong. I explained this
to YourHosting but they keep saying they're unable to
supply me with 'substantial support'. Whatever...

Besides the occasional miscommunication I have with them
they're a fine hosting company.


__________________
great-quotes.com
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 02 June 2011 at 4:39am

Hello, Dick

"Now I wish to write a rule for this subsite, let's say www.subsite.com/home -> www.subsite.com/home.aspx"
- please try to put the following into /home/html/httpd.ini:

RewriteCond %SERVER_NAME ^subsite\.com$
RewriteRule /home       /subsite.com/home.aspx [I,L]

__________________
Regards,
Anton
Back to Top
 
saefren
Newbie


Joined: 11 October 2010
Location: Netherlands
Posts: 10
Posted: 03 June 2011 at 12:27pm

Hi Anton,

Thank you for your reply. The rule you supplied does not
seem to work. I played around with it a bit but am unable
to get it to work.

Is it possible that it doesn't work because of the way the
sites are configured? I'm not really sure what's going on
'behind the screens'.

__________________
great-quotes.com
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 16 June 2011 at 7:49am

Please try to use:

RewriteCond %SERVER_NAME (www\.)?subsite\.com
RewriteRule /home       /subsite.com/home.aspx [I,L]

And please tell whether those 2 rules for subsite.com you showed above are working well?
And if yes, do they precede the rule we are working on?

__________________
Regards,
Anton
Back to Top
 
saefren
Newbie


Joined: 11 October 2010
Location: Netherlands
Posts: 10
Posted: 16 June 2011 at 3:01pm

It works. You are a genius! :)

I had to place your rule before the existing rules
created by the hosting provider. So now I've got:


# Anton rule
RewriteCond %SERVER_NAME (www\.)?subsite\.com
RewriteRule /home       /subsite.com/home.aspx [I,L]

# Hosting provider rules
RewriteCond %SERVER_NAME ^www\.subsite\.com$
RewriteRule (.*)        /subsite.com$1 [I,L]

RewriteCond %SERVER_NAME ^subsite\.com$
RewriteRule (.*)        /subsite.com$1 [I,L]


I also tried this with the rule from your first reply
(placing it in front of my hosting provider's rules) but
that didn't work.

I don't understand why the order matters or why my
hosting provider wouldn't give me this information. I
will send them a link to this topic. Maybe they can use
it for other customers with the same problem (if they're
able & willing :))

Thank you very much!

__________________
great-quotes.com
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version
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