1

我正在尝试像这样创建 Google Plus 重定向... www.domain.com/+

我创建了一个名为“+”的文件夹,里面有一个简单的 default.html 文件。Default.html 是一个默认文档,它包含一个简单的 JS 重定向。我得到一个 404,比如文件夹和文件不存在。很奇怪!

加号似乎对文件夹名称有效,所以我很难过。有任何想法吗?

谢谢

4

2 回答 2

1

在 web.config 中进行漂亮的 301 重定向怎么样:

<configuration>
    <system.webServer>
        <security>
            <requestFiltering allowDoubleEscaping="true" />
        </security>
    </system.webServer>
    <location path="+">
        <system.webServer>
        <httpRedirect enabled="true" destination="http://plus.google.com/{userprofileid}" httpResponseStatus="Permanent" />
        </system.webServer>
    </location>
</configuration>

编辑:我允许双重转义,这会禁用 IIS7 将 + 作为空格的插值。解决方案来自:http ://www.ifinity.com.au/Blog/entryid/60/404-error-in-iis-7-when-using-a-url-with-a-plus-sign-in-路径

于 2011-11-12T06:45:26.740 回答
0

在 IIS7 中,默认情况下,+ 经常被插入为空格。IIS7 可能允许使用名为 + 的文件夹,但 URL 处理器首先将其插入到空格中。

请参阅http://www.ifinity.com.au/Blog/entryid/60/404-error-in-iis-7-when-using-a-url-with-a-plus-sign-in-the-path解决方法,但这可能会带来安全漏洞。

于 2011-11-12T06:24:03.567 回答