URL重写无效

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

我在ASP.NET应用程序中添加了URL重写规则(nopcommerce 1.6)。规则是域名/产品代码将重定向到实际产品,即域名/ product.aspx。它在本地机器上完全正常工作但是当我在实时服务器上部署它时显示404错误。请帮助我的朋友。

I have added URL rewriting rule in ASP.NET application(nopcommerce 1.6). Rule is "Domain name/product-code" will redirect to actual product ie "domain name/product.aspx". Its completely working fine in local machine but when i am deploying it on live server it shows 404 error. Please help me friends.

推荐答案

请检查你的页面上是否有任何图像,因为该图像也需要完整路径,在这种情况下也是你将得到404错误。 Please check if there is any Image you have placed on your page, because that image is also required complete path, in that case also you will get 404 error.

我得到了解决方案。我添加了 I got solution. I added <rewrite> <rules> <rule name="rullll"> <match url="^p/([a-z0-9/]+)

/> < action type =Rewriteurl =page.aspx?productcode = {R:1}/> < / rule> < / rules> < / rewrite> " /> <action type="Rewrite" url="page.aspx?productcode={R:1}" /> </rule> </rules> </rewrite>

到web.config 并且在page.aspx中完成了一些编码工作。 (我从查询字符串中获取产品代码,然后重定向到该产品的相应aspx页面) 这里我做了一个妥协。用户需要输入url line domainname / p / product-code 而不是domainname / product-code

to web.config And have done some stuff of coding in page.aspx. (I got product code from query string and then redirected to respective aspx page of that product) Here i have made a compromise. User needs to enter url line domainname/p/product-code instead of domainname/product-code

更多推荐

URL重写无效

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

发布评论

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

>www.elefans.com

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