 |
|
 |
|
Next: Here's A Free Online Web Business Tutorial
|
| Author |
Message |
External

Since: Nov 05, 2007 Posts: 2
|
(Msg. 1) Posted: Mon Nov 05, 2007 3:00 am
Post subject: Conditional logic with IIS redirects: possible? Archived from groups: microsoft>public>inetserver>iis (more info?)
|
|
|
Hi,
I have a single webserver instance, blank host header. However I have
many domains pointing to it, a rather standard set up where seemingly
different sites share the same code base. It's the codebase that does
the job of showing the right data based on the host.
So, if I want to add a redirect using virtual directories, the issue I
face is that all sites share the redirect. There is no way for me to
say 'if the site is www.mysite.com' then this URL redirect should go
there. If not, go elsewhere'. Which is a big problem for me because
one of my sites needs many redirects, and sharing its redirects with
other smaller sites would not be appropriate (as users / google
spider / etc might accidently stumble on them).
So far I've been working around the issue by implementing the
redirects via code. But as my list of redirect grows it's becoming
impossible (and ugly) to manage.
Is there a way, either via the stock version of IIS or via some form
of plugin or extension, to implement conditional logic based on the
host header of a request?
Any help or pointer would be much appreciated! TIA! >> Stay informed about: Conditional logic with IIS redirects: possible? |
|
| Back to top |
|
 |  |
External

Since: Nov 05, 2007 Posts: 2
|
(Msg. 2) Posted: Mon Nov 05, 2007 4:17 am
Post subject: Re: Conditional logic with IIS redirects: possible? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Nov 5, 11:09 am, "Ken Schaefer" <kenREM... DeleteThis @THISadOpenStatic.com>
wrote:
> Erm,
>
> If you use Regular Expressions, or similar, in your code, then it wouldn't
> be a maintenance nightmare. Assuming that the virtual directories you need
> to redirect to have some defined relationship with the HTTP Host header sent
> by the client. If there's a 1:1 mapping, you could do something like:
>
> (this is untested psuedo-code):
>
> strHostHeader = Request.ServerVariables("HTTP_Host")
> Response.Redirect("/" & strHostHeader)
>
> Cheers
> Ken
>
> --
> My IIS Blog:www.adOpenStatic.com/cs/blogs/ken
>
> <cff... DeleteThis @gmail.com> wrote in message
>
> news:1194260453.962275.57240@k79g2000hse.googlegroups.com...
>
> > Hi,
>
> > I have a single webserver instance, blank host header. However I have
> > many domains pointing to it, a rather standard set up where seemingly
> > different sites share the same code base. It's the codebase that does
> > the job of showing the right data based on the host.
>
> > So, if I want to add a redirect using virtual directories, the issue I
> > face is that all sites share the redirect. There is no way for me to
> > say 'if the site iswww.mysite.com'then this URL redirect should go
> > there. If not, go elsewhere'. Which is a big problem for me because
> > one of my sites needs many redirects, and sharing its redirects with
> > other smaller sites would not be appropriate (as users / google
> > spider / etc might accidently stumble on them).
>
> > So far I've been working around the issue by implementing the
> > redirects via code. But as my list of redirect grows it's becoming
> > impossible (and ugly) to manage.
>
> > Is there a way, either via the stock version of IIS or via some form
> > of plugin or extension, to implement conditional logic based on the
> > host header of a request?
>
> > Any help or pointer would be much appreciated! TIA!
Good point, however, here's the problem: the directories need to exist
for the code to trigger. For example, if I want the /test directory to
redirect to /index.asp&theredirect=test, then the user must be
accessing the /test directory for the code in the /test directory to
run. When the user type www.mysite.com/test, iis is the first on to
run and of course will give a 404 if the /test directory doesn't
exist. >> Stay informed about: Conditional logic with IIS redirects: possible? |
|
| Back to top |
|
 |  |
External

Since: Aug 23, 2003 Posts: 3041
|
(Msg. 3) Posted: Mon Nov 05, 2007 7:02 am
Post subject: Re: Conditional logic with IIS redirects: possible? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Erm,
If you use Regular Expressions, or similar, in your code, then it wouldn't
be a maintenance nightmare. Assuming that the virtual directories you need
to redirect to have some defined relationship with the HTTP Host header sent
by the client. If there's a 1:1 mapping, you could do something like:
(this is untested psuedo-code):
strHostHeader = Request.ServerVariables("HTTP_Host")
Response.Redirect("/" & strHostHeader)
Cheers
Ken
--
My IIS Blog: www.adOpenStatic.com/cs/blogs/ken
<cffan3 DeleteThis @gmail.com> wrote in message
news:1194260453.962275.57240@k79g2000hse.googlegroups.com...
> Hi,
>
> I have a single webserver instance, blank host header. However I have
> many domains pointing to it, a rather standard set up where seemingly
> different sites share the same code base. It's the codebase that does
> the job of showing the right data based on the host.
>
> So, if I want to add a redirect using virtual directories, the issue I
> face is that all sites share the redirect. There is no way for me to
> say 'if the site is www.mysite.com' then this URL redirect should go
> there. If not, go elsewhere'. Which is a big problem for me because
> one of my sites needs many redirects, and sharing its redirects with
> other smaller sites would not be appropriate (as users / google
> spider / etc might accidently stumble on them).
>
> So far I've been working around the issue by implementing the
> redirects via code. But as my list of redirect grows it's becoming
> impossible (and ugly) to manage.
>
> Is there a way, either via the stock version of IIS or via some form
> of plugin or extension, to implement conditional logic based on the
> host header of a request?
>
> Any help or pointer would be much appreciated! TIA!
> >> Stay informed about: Conditional logic with IIS redirects: possible? |
|
| Back to top |
|
 |  |
External

Since: Aug 23, 2003 Posts: 3146
|
(Msg. 4) Posted: Mon Nov 05, 2007 10:11 am
Post subject: Re: Conditional logic with IIS redirects: possible? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Hi,
You can configure IIS so ISAPI extensions/filters can handle requests
without folders/files physically exists.
Whatever server side technology you use must however handle this properly
(ASP.NET 2.0 does).
As an alternative, ISAPI Rewrite is a popular product that can do this.
http://www.isapirewrite.com/
--
Regards,
Kristofer Gafvert
http://www.gafvert.info/iis/ - IIS Related Info
cffan3.RemoveThis@gmail.com wrote:
>On Nov 5, 11:09 am, "Ken Schaefer" <kenREM....RemoveThis@THISadOpenStatic.com>
>wrote:
>>Erm,
>>
>>If you use Regular Expressions, or similar, in your code, then it wouldn't
>>be a maintenance nightmare. Assuming that the virtual directories you need
>>to redirect to have some defined relationship with the HTTP Host header
>>sent
>>by the client. If there's a 1:1 mapping, you could do something like:
>>
>>(this is untested psuedo-code):
>>
>>strHostHeader = Request.ServerVariables("HTTP_Host")
>>Response.Redirect("/" & strHostHeader)
>>
>>Cheers
>>Ken
>>
>>--
>>My IIS Blog:www.adOpenStatic.com/cs/blogs/ken
>>
>><cff....RemoveThis@gmail.com> wrote in message
>>
>>news:1194260453.962275.57240@k79g2000hse.googlegroups.com...
>>
>>>Hi,
>>
>>>I have a single webserver instance, blank host header. However I have
>>>many domains pointing to it, a rather standard set up where seemingly
>>>different sites share the same code base. It's the codebase that does
>>>the job of showing the right data based on the host.
>>
>>>So, if I want to add a redirect using virtual directories, the issue I
>>>face is that all sites share the redirect. There is no way for me to
>>>say 'if the site iswww.mysite.com'then this URL redirect should go
>>>there. If not, go elsewhere'. Which is a big problem for me because
>>>one of my sites needs many redirects, and sharing its redirects with
>>>other smaller sites would not be appropriate (as users / google
>>>spider / etc might accidently stumble on them).
>>
>>>So far I've been working around the issue by implementing the
>>>redirects via code. But as my list of redirect grows it's becoming
>>>impossible (and ugly) to manage.
>>
>>>Is there a way, either via the stock version of IIS or via some form
>>>of plugin or extension, to implement conditional logic based on the
>>>host header of a request?
>>
>>>Any help or pointer would be much appreciated! TIA!
>
>Good point, however, here's the problem: the directories need to exist
>for the code to trigger. For example, if I want the /test directory to
>redirect to /index.asp&theredirect=test, then the user must be
>accessing the /test directory for the code in the /test directory to
>run. When the user type www.mysite.com/test, iis is the first on to
>run and of course will give a 404 if the /test directory doesn't
>exist. >> Stay informed about: Conditional logic with IIS redirects: possible? |
|
| Back to top |
|
 |  |
External

Since: Feb 05, 2007 Posts: 112
|
(Msg. 5) Posted: Mon Nov 05, 2007 3:02 pm
Post subject: Re: Conditional logic with IIS redirects: possible? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Why aren't you using host headers?
I think you are going to have to write an ISAPI filter to do what you
describe.
<cffan3 DeleteThis @gmail.com> wrote in message
news:1194260453.962275.57240@k79g2000hse.googlegroups.com...
> Hi,
>
> I have a single webserver instance, blank host header. However I have
> many domains pointing to it, a rather standard set up where seemingly
> different sites share the same code base. It's the codebase that does
> the job of showing the right data based on the host.
>
> So, if I want to add a redirect using virtual directories, the issue I
> face is that all sites share the redirect. There is no way for me to
> say 'if the site is www.mysite.com' then this URL redirect should go
> there. If not, go elsewhere'. Which is a big problem for me because
> one of my sites needs many redirects, and sharing its redirects with
> other smaller sites would not be appropriate (as users / google
> spider / etc might accidently stumble on them).
>
> So far I've been working around the issue by implementing the
> redirects via code. But as my list of redirect grows it's becoming
> impossible (and ugly) to manage.
>
> Is there a way, either via the stock version of IIS or via some form
> of plugin or extension, to implement conditional logic based on the
> host header of a request?
>
> Any help or pointer would be much appreciated! TIA!
> >> Stay informed about: Conditional logic with IIS redirects: possible? |
|
| Back to top |
|
 |  |
| Related Topics: | ASP script timeout - what is the logic ? - Hello, ASP script timeout is set to 90 seconds. But if there is an aspx page which is making select to the database, and the select lasts long time, the page is running more than 90 seconds. After that time the data are returned to the browser. Why the....
Load balancing: stupid logic? - Win NT 4.0 IIS 4.0 1) ASP files are deployed in a shared folder on a remote server. 2) 2 IIS servers behind a load balancer are using the same ASP source in a so called 'load balanced' environment to deploy the application. [There is no physical copy...
IIS Redirects - Hi all; I've got a quick ? on redirects. I want to move my website from one server to another but want to test it out with the redirect first before committing the DNS change with my ISP. On the existing server, I redirected the URL to an active ..
redirects in IIS... - Does IIS 5.0 have any capability to read a file (such as an .htaccess file that can be uploaded to an Apache server) that will re-direct visits to certain pages within a web to newly created pages with different extentions? Thanks in advance for any..
SSL redirects to another SSL - Hi, I have a HTTPS server and I would like to redirect from this HTTPS server to other HTTPS server. Can it be done and how? appreciate if u can advise. regards, Ben |
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
 |
|
|