English 中文(简体)
URL如何为URL进行改写,以掩盖档案名称。 as和 que
原标题:How to do URL rewriting for the URL to hide filename.aspx and querystring?
问题回答

URL 改写有些含糊不清。 您是否重写用户的看法? 或者服务器看到什么? 更有理由相信,你无法改变URL向网站消费者展示的内容。

然而,骗局是将他们送到一个破碎的、不是真实的URL...,然后是ReWrite the URL for YOU,因此,你知道这种不现实的URL意味着什么。 例如:

想象你们有这样的现实:

http://www.example.com/folder/subfolder/page.ext?param=value

But you want to "Rewrite" the URL to look like so:

If they are on the page page.ext..., you cannot change what they see in their URL bar. But, you can Redirect Them to a fake path /subfolder/value like so:

<rule name="subFolder Value Redirect">
  <conditions>
    <add input="{REQUEST_URI}" pattern="^/folder/([^/]+)/page.ext?param=([^&]+)$" />
  </conditions>
  <action type="Redirect" url="/{C:1}/{C:2}" />
</rule>

Above, I am not doing a "url match" because I am depending solely on a Condition. My only Condition is that the Request_URI looks exactly like I expect. Some folder, some subfolder name, page.ext, and a querystring with param=SomeValue. I use () parenthesis to dynamically capture the Subfolder Name and the param Value.

注:{C:0}是指“0th”Capture Group of the Conditions。 页: 1 页: 1 第2组是第二组,即准值。

<代码><,在reg开始之初即指“从一开始”。 有时,你不想在一开始就开始,那就没有了。

。 有时,你不想最终结束,那就没有了。

特性类别<代码>[^...]系指捕获任何非<代码>的特性。 在本案中,所捕捉的不是闪点的东西,或非阿姆手的东西。

The repetition operator [...]+ Plus-Symbol means to capture the preceding rule at least once, but up to many times.

<代码>:为特殊性质,是指“任何类型”。 但是,我们就是指在延伸<编码>网页.ext上。 页: 1

{REquestST_URI} 系指在域名/港口之后将您的模式与整个URL相比较。 http://www.example.com:1234/subrafter...。 The /subrafter and all following content are in the{RE RequestST_URI} EXCEPT hashtag routing. 因此,如果你有一条航道或安航道,这些航道只停留在浏览器上,而且总是在任何转子的末尾,但服务器永远不会看到这些路子,因此你可以把 has子捆起来。

http://www.un.org/Depts/DGACM/index_french.htm

url=”/{C:1}/{C:2}”是指相对于这个领域而言的URL,因为它没有从议定书开始。 这将转向/代用/价值,因为在我们的模式中,条件捕获1和条件捕获2体现了这两个价值观。

在插入这一规则后,用户将转向类似于国家代表的URL(RESTful)。

URL Rewriting

旋转器为你(服务器),而不是客户。 但是,现在,他们被转往破碎的冰箱上,你可以找到该电网的背景,并通过改写给服务器来告诉你的服务器。

<rule name="subFolder Value Rewrite">
  <conditions><add input="{REQUEST_URI}" pattern="^/([^/]+)/([a-zA-Z0-9]+)$" /></conditions>
  <action type="Rewrite" url="/folder/{C:1}/page.ext?param={C:2}" />
</rule>

这与先前的规则相反。 这是一种模式,即有一条“潜水器”的名称、斜线和由信函和号码构成的价值。 该文件还再次描述了“起始点”<代码><>>>>和“终端<代码>>,因为我们并不期望意外的杂货。 因此,这将赶上南盟这样的一个:

/code>

But will not catch

The rewrite URL then evaluates back to a true real URL that maps to a path for processing for a file that really exists. And, keep in mind, that "rewrite" means it takes the "incorrect" fake value that the user sees, and rewrites it back to an ugly "correct" value for the server. Not the other way around.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签