Вопрос

Very strange thing; I'm using the following in web.config file to redirect everything from one domain to specific page on another domain:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <httpRedirect enabled="true" destination="http://www.example.com/my-page.html" />
  </system.webServer>
</configuration>

However, trailing slash is appended to the URL, resulting in a 404:

http://www.example.com/my-page.html/

How can I force redirect WITHOUT the trailing slash?

Thanks!

Это было полезно?

Решение

add exactDestination="true" to your config. It should look like this

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <httpRedirect enabled="true" destination="http://www.example.com/my-page.html" exactDestination="true" />
  </system.webServer>
</configuration>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top