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
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: Rewrites for a domain in a subfolder Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
saefren
Newbie
Newbie


Joined: 11 October 2010
Location: Netherlands
Online Status: Offline
Posts: 10
Posted: 01 June 2011 at 11:02am | IP Logged Quote saefren

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 View saefren's Profile Search for other posts by saefren
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 02 June 2011 at 4:39am | IP Logged Quote Anton

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 View Anton's Profile Search for other posts by Anton
 
saefren
Newbie
Newbie


Joined: 11 October 2010
Location: Netherlands
Online Status: Offline
Posts: 10
Posted: 03 June 2011 at 12:27pm | IP Logged Quote saefren

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 View saefren's Profile Search for other posts by saefren
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 16 June 2011 at 7:49am | IP Logged Quote Anton

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 View Anton's Profile Search for other posts by Anton
 
saefren
Newbie
Newbie


Joined: 11 October 2010
Location: Netherlands
Online Status: Offline
Posts: 10
Posted: 16 June 2011 at 3:01pm | IP Logged Quote saefren

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 View saefren's Profile Search for other posts by saefren
 

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