繁体   English   中英

IIS 7.5 URL重写不起作用? 请帮助

[英]IIS 7.5 URL Rewrite not working? help please

我正在尝试重写URL,因此它采用了my.site.com等URL,并将其重写为“ Http:// localhost:8080”。 我一直在获取默认主页,而不是被重定向。 我已将重写配置如下:

<?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>

我很茫然,我做错了什么吗?

任何帮助将不胜感激。

干杯杰夫

目前尚不清楚要实现的目标和原因,但并不是100%明确,但是由于涉及到localhost,您似乎不想重写,但可能要执行http redirect 重写意味着您的请求URL已被更改为另一个URL,例如index_foo.htm可以重写为index.aspx?what = foo。

但是您想更改域,因此需要重定向 尝试:

<system.webServer>
    <httpRedirect enabled="true" destination="http://localhost:8080" childOnly="false" />
</system.webServer>

这将保留您调用的任何本地页面,即my.site.com/foo.htm将被重定向到localhost:8080 / foo.htm。

因为这看起来只是出于开发目的的临时性任务,所以您可以添加

 httpResponseStatus="Temporary"

到httpRedirect(对于不丢失搜索引擎排名可能很重要)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM