SEO 公司要求将每个 404 错误请求重定向到特定 url.我要求将错误 400(错误请求)重定向到特殊页面.
我可以在 web.config 文件中完成,但要求是每个 url 到特殊页面例如stackoverflow/questions/askstackoverflow/questions/ask =>(301) stackoverflow/questions/askstackoverflow/questionsstackoverflow/questions => (301)stackoverflow/questions
有可能吗?我的应用程序是 IIS 服务器上的 ASP.NET(不是 MVC)
谢谢
解决方案在 asp webforms 上设置一个页面,即 Redirect.aspx 来重定向所有类型为 400 的错误:
<system.web><customErrors defaultRedirect="Error.htm"mode="RemoteOnly"><错误状态代码="400"重定向=重定向.aspx"/></customErrors></system.web>然后在页面上看到它来自的网址:
Request.UrlReferrer然后相应地处理
The Seo Company ask for making redirect each 404 bad request to specific url. I asked for redirect an error 400 (Bad request) to special page.
I can do it in the web.config file, but the requirement is each url to special page for example stackoverflow/questions/askstackoverflow/questions/ask =>(301) stackoverflow/questions/ask stackoverflow/questionsstackoverflow/questions => (301) stackoverflow/questions
Is it possible? My application is ASP.NET (Not MVC) on IIS SERVER
Thanks
解决方案On asp webforms set a page i.e. Redirect.aspx to redirect all the Error of type 400:
<configuration> <system.web> <customErrors defaultRedirect="Error.htm" mode="RemoteOnly"> <error statusCode="400" redirect="Redirect.aspx"/> </customErrors> </system.web>then on the page see the Url it cames from by:
Request.UrlReferrerthen handle accordingly
更多推荐
错误 400 错误请求
发布评论