ASP.Net - 带重写的 URL 转发
我正在开发一个使用 CMS 的网站,我的实际主页位于 mydomain.com/cms/home.aspx
当用户访问 mydomain.com/index.aspx 时,如何将网站访问者转发到 mydomain.com/cms/home.aspx?
一种方法是创建一个虚拟的index.aspx,并重定向到mydomain.com/cms/home.aspx,但只是想知道是否有更好的方法......可能在web.config或其他地方!
谢谢
席德
I am developing a web site that uses a CMS and my actual home page is at mydomain.com/cms/home.aspx
When a user visits mydomain.com/index.aspx how to do I forward the site visitors to mydomain.com/cms/home.aspx?
One way is to create a dummy index.aspx with redirect to mydomain.com/cms/home.aspx but just wondering if there is a better way to do... may be in web.config or somewhere else!
Thanks
Sid
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
重定向:如何在 IIS 中重定向 URL 路径?
重写: http://learn.iis.net/ page.aspx/460/using-the-url-rewrite-module/
两者都需要一些学习,但可以在合理的时间内实现。
您始终可以选择自己编写。对于重写,您可以编写 HTTPModule(或更新 CMS 的重写模块)。对于重定向,您可以使用自定义 404 页面来处理重定向。我已经为 DotNetNuke 完成了这两项工作。我自己的滚动大约花费了 16 个小时,但通过缓存可以有效地处理数十万个。
Redirects: How to redirect a URL path in IIS?
Rewrites: http://learn.iis.net/page.aspx/460/using-the-url-rewrite-module/
Both are a bit of learning, but can be achieved in a reasonable amount of time.
You always have the option of writing your own. For rewrites, you can write an HTTPModule (or update your CMS's rewrite module). For redirects, you can use a custom 404 page to handle redirects. I have done both for DotNetNuke. Rolling my own took about 16 hours, but handles a few hundred thousand of each efficiently with caching.