Pergunta

I'm attempting to create a Google Plus redirect like this... www.domain.com/+

I have created a folder named "+" with a simple default.html file inside. Default.html is a default document and it contains a simple JS redirect. I get a 404 like the folder and file do not exist. Very strange!

The plus character appears to be valid for folder names so I'm stumped. Any ideas?

Thanks

Foi útil?

Solução

How about a nice 301 redirect in a web.config:

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

Edit: I allowed double escaping which disables IIS7's interpolation of a + as a space. Solution obtained from: http://www.ifinity.com.au/Blog/entryid/60/404-error-in-iis-7-when-using-a-url-with-a-plus-sign-in-the-path

Outras dicas

In IIS7, by default, + is often times interpolated as a space. IIS7 may allow for folders named +, but the URL processor is interpolating it first to a space.

See http://www.ifinity.com.au/Blog/entryid/60/404-error-in-iis-7-when-using-a-url-with-a-plus-sign-in-the-path for a workaround, but this potentially opens up security flaws.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top