Aram Boyajyan
Aram Boyajyan

Reputation: 844

Web.config redirect to another URL without trailing slash

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!

Upvotes: 1

Views: 1416

Answers (1)

ahmelsayed
ahmelsayed

Reputation: 7402

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>

Upvotes: 2

Related Questions