如何将http:// localhost:9909 / abcdef重写为http:// localhost:9909 / default.aspx? ABCDEF [英] How to rewrite http://localhost:9909/abcdef to http://localhost:9909/default.aspx? Abcdef

查看:90
本文介绍了如何将http:// localhost:9909 / abcdef重写为http:// localhost:9909 / default.aspx? ABCDEF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个URL缩短,用于转换https://www.moneycontrol.com/news/india/karnataka-election-results-2018-live-updates-missing-mlas-raise-concerns-in-congress-jds -camp-2568569.html



到http:// localhost:9909 / vrUD4r





现在当我点击url http:// localhost:9909 / vrUD4r时会转到错误页面!



如何转移/重定向http: // localhost:9909 / vrUD4r到http:// localhost:9909 / default.aspx?vrUD4r



请注意http:// localhost:9909 /之后的值是任何6个字符的alphaneumeric!即它可以是http:// localhost:9909 / vrUD4r http:// localhost:9909 / abCD4E或http:// localhost:9909 / ab342D用于不同的缩短网址。



i设法缩短长网址,但是当我输入短网址时,如何重定向到原始网址。即如果我输入http:// localhost:9909 / vrUD4r,它必须将我重定向到原始网址:https://www.moneycontrol.com/news/india/karnataka-election-results-2018-live-updates-missing-mlas -raise-concern-in-congress-jds-camp-2568569.html



我尝试过:



当我点击http:// localhost:9909时,我添加了默认页面,它会转到http:// localhost:9909 / default.aspx

,如下所示:

< defaultDocument> 
< files>
< add value =shrtn.aspx/>
< / files>
< / defaultDocument>





我也尝试在web.config中添加重写规则,如下所示:



<重写> 
< rules>
< rule name =redirectRulestopProcessing =true>
< match url =^ / * $/>
< action type =Redirecturl =/ shrtn.aspx / {R:0}redirectType =Found/>
< / rule>
< / rules>
< / rewrite>

解决方案

/>
< action type =Redirecturl =/ shrtn。 aspx / {R:0}redirectType =Found/>
< / rule>
< / rules>
< / rewrite>


I have created a URL shortening which converts https://www.moneycontrol.com/news/india/karnataka-election-results-2018-live-updates-missing-mlas-raise-concerns-in-congress-jds-camp-2568569.html

into http://localhost:9909/vrUD4r


now when i hit url http://localhost:9909/vrUD4r it goes to error page!

how can i transfer/redirect http://localhost:9909/vrUD4r to http://localhost:9909/default.aspx?vrUD4r

note that value after http://localhost:9909/ can be any 6 character alphaneumeric! i.e. it can be http://localhost:9909/vrUD4r http://localhost:9909/abCD4E OR http://localhost:9909/ab342D for the different shortened urls.

i manage to shorten the long url, but how can i redirect to original url when i enter short url. i.e. if i enter http://localhost:9909/vrUD4r it must redirect me to original url : https://www.moneycontrol.com/news/india/karnataka-election-results-2018-live-updates-missing-mlas-raise-concerns-in-congress-jds-camp-2568569.html

What I have tried:

I have added default page when i hit http://localhost:9909 it goes to http://localhost:9909/default.aspx
as follows :

<defaultDocument>
   <files>
     <add value="shrtn.aspx" />
   </files>
 </defaultDocument>



also i have tried adding rewrite rule in web.config as follows :

<rewrite>
  <rules>
    <rule name="redirectRule" stopProcessing="true">
      <match url="^/*$" />
      <action type="Redirect" url="/shrtn.aspx/{R:0}" redirectType="Found"/>
    </rule>
  </rules>
</rewrite>

解决方案

" /> <action type="Redirect" url="/shrtn.aspx/{R:0}" redirectType="Found"/> </rule> </rules> </rewrite>


这篇关于如何将http:// localhost:9909 / abcdef重写为http:// localhost:9909 / default.aspx? ABCDEF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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