如何将 URL 转发到适当的页面?
如何将
转发到适当的页面:
http://www.mysite.com/JoinOptions/MemberRegistration.aspx
有什么方法可以做到这一点吗?
我正在使用 DNN CMS,但如果您不熟悉 DNN 并且仍然有重定向解决方案,那将会很有帮助。
谢谢,
马特
How can I forward a url such as:
to the appropriate page:
http://www.mysite.com/JoinOptions/MemberRegistration.aspx
Is there some way to do this?
I'm using a DNN CMS but if you're unfamiliar with DNN and still have a solution for redirecting that would be helpful.
Thanks,
Matt
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您可以在 DNN 中创建“友好 URL 规则”。在“主机设置”页面中,打开“高级设置”部分中的“友好 URL”部分。从那里您可以添加一条与
.*/Join/Default.aspx
匹配的新规则,并将其替换为~/JoinOptions/MemberRegistration.aspx
(我相当确定使用这种风格的 URL 是可行的,但我知道您可以用像~/Default.aspx?tabid=423
这样的 URL 来替换。使用此方案,您需要确保 IIS 让 ASP.NET 处理该请求。最简单的方法是在文件系统中添加一个“Join”文件夹,其中包含一个名为 Default.aspx 的文件。
You can create a "friendly URL rule" within DNN. In the Host Settings page, open the Friendly URL section within the Advanced Settings section. From there you can add a new rule, that matches
.*/Join/Default.aspx
and replaces it with~/JoinOptions/MemberRegistration.aspx
(I'm fairly sure that using that style of URL will work, but I know that you can replace with a URL like~/Default.aspx?tabid=423
).Using this scheme, you need to make sure that IIS lets ASP.NET process the request. The easiest way to do that is to add a "Join" folder in your file system with a file called Default.aspx.
我们曾经使用过 SnowCovered 的 DNN 模块,您可以在这里获取它: http://www.snowcovered.com/Snowcovered2/Default.aspx?tabid=242&PackageID=7262
价格为 15 美元,但无需任何编码即可完成您需要的操作。
您将创建一个
/Join
页面并将其重定向到/JoinOptions/MemberRegistration.aspx
We once used a DNN module from SnowCovered, you can get it here: http://www.snowcovered.com/Snowcovered2/Default.aspx?tabid=242&PackageID=7262
It's $15 but it will do what you need to without any coding.
You will create a page that is
/Join
and redirect it to/JoinOptions/MemberRegistration.aspx
如果您使用 Apache,您可以创建或编辑现有的 .htaccess 文件,其中包含:
并将其放置在根目录中(http://www.mysite.com/ 指向)
阅读 Apache .htaccess 文件 和 <除此之外还有 href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html" rel="nofollow noreferrer">mod_rewrite 。
编辑:哎呀。没有检查标签。
If you are using Apache you can create or edit an existing .htaccess file containing:
And place it in your root directory (the directory that http://www.mysite.com/ points to)
It may be useful to read up on Apache .htaccess files and mod_rewrite in addition to this.
Edit: Oops. Didn't check the tags.
实际上,无需接触 IIS,也无需花任何钱,您可以通过一些技巧来做到这一点。
添加下面的代码
如果更改页面名称,则必须重新编辑文件,但它可以工作
注意:可能必须用实际的&符号替换amersan amp
Actually without touching IIS and without spending any money you can do this with a little trickery.
add the code below
If you change the Page name you would have to re-edit the file but it works
note:might have to replace the amersan amp with an actual ampersand
如果您使用的是 IIS,则可以使用 ISAPI_Rewrite3 工具。该网站的 .htaccess 为:
If you are on IIS, you can use ISAPI_Rewrite3 tool. The .htaccess for the site will be:
还有另一种选择。可能比接受的答案更像是一个黑客。
在 IIS 中启用通配符映射
这允许无扩展名 URL 工作(例如 http://yoursite.com/加入)
在 DNN 中创建一个名为“Join”的页面,并将其重定向到所需页面
添加一个名称/标题为 Join 的页面,将其设置为不在菜单中显示,并将其设置为301 重定向到您想要的 URL(这些都是页面设置中的选项)
* 通常类似于 C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
Yet another option. Probably a little bit more of a hack than the accepted answer.
Enable wildcard mapping in IIS
This allows extensionless URLs to work (e.g. http://yoursite.com/Join)
Create a page in DNN called "Join" and redirect it to the desired page
Add a page with the name/title Join, set it to not show up in the menu, and set it to 301 redirect to your desired URL (these are all options in the page's settings)
* typically something like C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll