URL重写无效 [英] URL rewriting not working

查看:83
本文介绍了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重写无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆