ASP.Net - 带重写的 URL 转发

发布于 2024-11-07 06:32:52 字数 258 浏览 4 评论 0原文


我正在开发一个使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

稚气少女 2024-11-14 06:32:52

重定向:如何在 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.

不奢求什么 2024-11-14 06:32:52
<redirect url="index.aspx" to="~/Pages/1/home.aspx"></redirect>
<redirect url="index.aspx" to="~/Pages/1/home.aspx"></redirect>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文