gpt4 book ai didi

asp.net - ASP.NET URL重写

转载 作者:行者123 更新时间:2023-12-03 08:30:12 24 4
gpt4 key购买 nike

如何在ASP.NET中重写URL?

我希望用户能够转到 http://www.website.com/users/smith 而不是 http://www.website.com/?user=smith

最佳答案

尝试使用托管的Fusion Url重写器和反向代理:

http://urlrewriter.codeplex.com

重写的规则是:

# clean up old rules and forward to new URL
RewriteRule ^/?user=(.*) /users/$1 [NC,R=301]

# rewrite the rule internally
RewriteRule ^/users/(.*) /?user=$1 [NC,L]

关于asp.net - ASP.NET URL重写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2262/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com