Search code examples
iisurl-rewritingiis-10

Show Full URL path automictically when browsing. IIS


We are using IIS 10 I have a user that wants their site and subsites to show the full URL path when browsing. For example, if you go to mysite.domain.com/ or mysite.domain.com/subsite/ it will show you mysite.domain/file.html or mysite.domain.com/subsite/file.html in the URL Is there a way in IIS to tell it to show the full path or append the file somehow?

The reasoning for this within Google Analytics there getting reports for both sites and just want the mysite.domain.com/file.html and not mysite.domain.com/ I think the main files there concerned about are the index.html files being seen in URL.

I know a little about URL Rewrite rules but by far no expert for sure but I can't figure out if this is possible or not. Thanks, any advice.

We are using IIS 10

I tried to basic redirect rule in URL rewrite, but I am not sure if that it what I am really asking for.


Solution

  • <rule name="Rule SEF Redirect Subfolders/Index.html Rule " enabled="false" stopProcessing="true">
    <match url="^(.*)$" ignoreCase="false" />
    <conditions logicalGrouping="MatchAll">
       <add input="{REQUEST_FILENAME}index.html" matchType="IsFile" />
    </conditions>
     <action type="Redirect" url="{R:1}index.html" />
      </rule>