IIS 7 URL重写的配置问题,或者MVC路线? [英] IIS 7 URL Rewrite config issue or MVC Route?

查看:122
本文介绍了IIS 7 URL重写的配置问题,或者MVC路线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Gearhost.com一个帐户,当谈到设立目前您需要去和配置URL使用IIS远程管理重写条目子域。

I have an account with Gearhost.com and when it comes to setting up sub-domains you are currently required to go in and configure an URL Rewrite entry using IIS Remote Admin.

目录文件夹结构如下格局:

The directory folder structure follows the pattern:

\mastersite
\mastersite\subdomain1

这是如何做到这一点的Gearhost知识库文章可以在这里找到:
<一href=\"https://support.gearhost.com/KB/a851/setting-a-subdomains-content-location-using-url-rewrite.aspx?KBSearchID=0\" rel=\"nofollow\">https://support.gearhost.com/KB/a851/setting-a-subdomains-content-location-using-url-rewrite.aspx?KBSearchID=0

The Gearhost KB Article on how to do it can be found here: https://support.gearhost.com/KB/a851/setting-a-subdomains-content-location-using-url-rewrite.aspx?KBSearchID=0

这工作得很好,但我跑成发现通过使用master.com/sub-domain路径访问子域的能力的情况。

This works just fine, but I ran into a scenario that revealed the ability to access the sub-domain by using the master.com/sub-domain path.

subdomain1.site.com (works)
www.site.com/subdomain1 (displays site also --which I don't want)

我不知道,如果知识库文章可在IIS或者如果我需要管理我的Microsoft MVC 3应用路由配置子域的正确方法。

I don't know if the KB article is the correct way to configure sub-domains in IIS or if I need to manage the routing in my Microsoft MVC 3 Application.

比方说,这是正确的方法来设置/配置一个子域。有没有办法来限制第二个选项的路径,所以它是没有发现或什么的页面的访问被禁止返回这个效果呢?

Let's say it is the correct way to setup/configure a sub-domain. Is there a way to restrict the path for the 2nd option, so it returns as page not found or access forbidden or something to this effect?

我正在开发一个微软MVC应用程序,如果我用一个Request.Url的号召,它实际上会返回甚至当我坐在什么样子的子一个完美的路径第二个选项的完整路径域主页。

I'm developing a Microsoft MVC Application and if I use a "Request.Url" call, it actually returns the full path of the 2nd option even when I'm sitting on what looks like a perfect path to the sub-domain home page.

所以我不知道这需要处理不同的方式,如果URL重写条目需要改变,或者解决方案可能是什么。

So I don't know if this needs to be handled a different way, if the URL Rewrite entry needs to be changed, or what the solution may be.

这是谁可能对话题的更多知识的工程师寻找反馈。

Looking for feedback from any engineers who may have more knowledge on the topics.

感谢。

推荐答案

我读到一篇<一跑href=\"http://weblogs.asp.net/owscott/archive/2010/05/26/url-rewrite-multiple-domains-under-one-site-part-ii.aspx\"相对=nofollow>文章,其中解决了我原来的请求帮助。

据参与创建IIS传出规则,重命名的路径。规则看起来有问题的路径,然后重写它。

It involved creating Outgoing rules in IIS, to rename the path. The rule looks for the path in question and then rewrites it.

每<一个href=\"http://weblogs.asp.net/owscott/archive/2010/05/26/url-rewrite-multiple-domains-under-one-site-part-ii.aspx\"相对=nofollow>文章,我曾经传出规则#2。

Per the article I used Outgoing rule # 2.

Pre-Condition: None
Matching Scope: Server Variable
Variable Name: RESPONSE_LOCATION
Variable Value: Matches the Pattern
Using: Regular Expressions
Pattern: ^(?:MyMasterSiteSubFolder/MySubDomain|(.*//[_a-zA-Z0-9-\.]*)?/MyMasterSiteSubFolder/MySubDomain)(.*)
[x] Ignore case
Action: Rewrite
Action Properties Value: {R:1}{R:2}
[x] Replace existing server variable value
[ ] Stop processing of subsequent rules

这篇关于IIS 7 URL重写的配置问题,或者MVC路线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆