[英]IIS 7.5 URL Rewrite not working? help please
I am trying to get a URL rewrite so it takes a URL for eg my.site.com and rewrites it to "Http://localhost:8080". 我正在尝试重写URL,因此它采用了my.site.com等URL,并将其重写为“ Http:// localhost:8080”。 I keep getting default homepage instead of it being redirected.
我一直在获取默认主页,而不是被重定向。 I have configured the rewrite as follows :
我已将重写配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="mysite">
<match url="(my.+)" />
<action type="Rewrite" url="http://localhost:8080" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
I am at a loss, is there something I am doing wrong ??? 我很茫然,我做错了什么吗?
Any help will be greatly appreciated. 任何帮助将不胜感激。
Cheers Jeff 干杯杰夫
It is not 100% clear what you want to achieve and why, but because localhost is involved, it seems you do not want to rewrite but maybe perform a http redirect . 目前尚不清楚要实现的目标和原因,但并不是100%明确,但是由于涉及到localhost,您似乎不想重写,但可能要执行http redirect 。 Rewriting means that your request URL is sort of changed into another one, like index_foo.htm could be rewritten to index.aspx?what=foo.
重写意味着您的请求URL已被更改为另一个URL,例如index_foo.htm可以重写为index.aspx?what = foo。
But you want to change the domains, so you need to redirect . 但是您想更改域,因此需要重定向 。 Try:
尝试:
<system.webServer>
<httpRedirect enabled="true" destination="http://localhost:8080" childOnly="false" />
</system.webServer>
This will keep whatever local page you have called, ie my.site.com/foo.htm will be redirected to localhost:8080/foo.htm. 这将保留您调用的任何本地页面,即my.site.com/foo.htm将被重定向到localhost:8080 / foo.htm。
Because this looks like a temporary thing for development purposes, you can add 因为这看起来只是出于开发目的的临时性任务,所以您可以添加
httpResponseStatus="Temporary"
to httpRedirect (may be important in order not to lose search engine rankings). 到httpRedirect(对于不丢失搜索引擎排名可能很重要)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.