如何重写url像子域

编程入门 行业动态 更新时间:2024-10-28 19:25:42
本文介绍了如何重写url像子域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何将example/page.aspx?firstname=kiya等网址重写为kiya.example?是否可以像子域一样进行重写。 重写像aarti.example这样的子域名后,必须打开page.aspx页面... 我尝试了很多东西,但没有任何工作...... 有很多关于重写的帖子一个url作为子域但没有任何工作正常。 有人能给我一个完美的解决方案吗?

How do I rewrite a URL like example/page.aspx?firstname=kiya to kiya.example? Is it possible to do a rewrite like sub domain. After rewriting the subdomain like aarti.example 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以及重写引擎的操作,您应该得出相同的结论: en.wikipedia/wiki/Domain_Name_System [ ^ ], en.wikipedia/wiki/HTTP [ ^ ], en.wikipedia/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: en.wikipedia/wiki/Domain_Name_System[^], en.wikipedia/wiki/HTTP[^], en.wikipedia/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像子域

本文发布于:2023-10-31 17:33:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546788.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重写   url   像子域

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!