如何重写url像子域 [英] How to Rewrite url like sub domain

查看:97
本文介绍了如何重写url像子域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将example.com/page.aspx?firstname=kiya等网址重写为kiya.example.com?是否可以像子域一样进行重写。



重写像aarti.example.com这样的子域名后,必须打开page.aspx页面...



我尝试了很多东西,但没有任何工作......



有很多关于重写的帖子一个url作为子域但没有任何工作正常。

有人能给我一个完美的解决方案吗?

How do I rewrite a URL like example.com/page.aspx?firstname=kiya to kiya.example.com? Is it possible to do a rewrite like sub domain.

After rewriting the subdomain like aarti.example.com it must open a page.aspx page...

I have tried lots of things but nothing is working...

There is lots of posts about rewriting a url as sub domain but nothing is working properly.
Can anyone give me a perfect solution?

推荐答案

我认为不可能。如果可能的话,它会混淆域解析,这应该在HTTP请求发送到服务器之前发生。要使重写引擎进入播放状态,您必须将HTTP请求与URL已分派到此重写引擎所在的服务器。如果实际的子域确实存在,请求将被发送到该子域,不会到达您的重写引擎;如果它不存在,请求将无处可去,无论如何都不会到达重写引擎。如果您研究DNS如何使用HTTP以及重写引擎的操作,您应该得出相同的结论:

http://en.wikipedia.org/wiki/Domain_Name_System [ ^ ],

http://en.wikipedia.org/wiki/HTTP [ ^ ],

http://en.wikipedia.org/wiki/Rewrite_engine [ ^ ]。



-SA
I don't think it's possible. If it was possible, it would confuse the domain resolution, which should happen before the HTTP request is sent to the server. And to make the rewrite engine come in to play, you have to have HTTP request with URL already dispatched to the server where this rewrite engine works. If the actual sub-domain does exist, the request will be sent to that sub-domain, won't reach you rewrite engine; and if it does not exist, the request will go nowhere and won't reach the rewrite engine anyway. You should come to the same conclusions if you study how DNS works with HTTP and the operation of rewrite engines:
http://en.wikipedia.org/wiki/Domain_Name_System[^],
http://en.wikipedia.org/wiki/HTTP[^],
http://en.wikipedia.org/wiki/Rewrite_engine[^].

—SA


您好Aarti,



我可以建议您在某种程度上达到您的要求。有一个概念,如 URL REWRITING 。使用此概念,您可以实现部分需求。您可以像查询字符串一样屏蔽URL的某些部分,并且可以实现您尝试的目标。这是一个非常神的URL,它将帮助您深入了解如下。



url-rewriting-with-asp-net



Hopw这将帮助你实现你的目标。



谢谢&问候

Sisir Patro
Hi Aarti,

I can suggest you one way to achieve your requirement upto some extent. There is a concept like URL REWRITING. Using this concept you can able to achieve some portion of your requirement. You can able to mask some of the portions of the URL like querystring and can achieve the goal you are trying to do. Here is a very god URL which will help you understanding in depth follow below.

url-rewriting-with-asp-net

Hopw this will help you to achieve your goal.

Thanks & Regards
Sisir Patro


这篇关于如何重写url像子域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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