Microsoft - IIS server

Prev Next

Plans supporting this feature: Professional Business Enterprise

Hosting a knowledge base in a subfolder seamlessly integrates documentation into your existing website structure. For example, setting up a subfolder path like /help allows users to access your knowledge base directly within your domain, such as example.document360.io/help.

To get started, ensure you replace the example domain in the configurations with your Document360-provided domain or your custom domain.


Pre-requisites


Setting up a sub-folder path

  1. Install the URL Rewrite module for IIS Server

  2. Install the Application Request Routing module, and ensure it is enabled.

  3. Add the following rewrite rule in web.config to rewrite the contents from your documentation at /help.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="ReverseProxy_HomePage" enabled="true" stopProcessing="true">
                    <match url="^help$" />
                    <action type="Rewrite" url="https://example.document360.io/v1" />
                    <serverVariables>
                        <set name="HTTP_requested_by" value="proxy" />
                        <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
                        <set name="HTTP_ACCEPT_ENCODING" value="" />
                    </serverVariables>
                </rule>
        <rule name="ReverseProxy_DocsPage" enabled="true" stopProcessing="true">
                    <match url="^help/(.*)" />
                    <action type="Rewrite" url="https://example.document360.io/help/{R:1}" />
                    <serverVariables>
                        <set name="HTTP_requested_by" value="proxy" />
                        <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
                        <set name="HTTP_ACCEPT_ENCODING" value="" />
                    </serverVariables>
                </rule>
        <rule name="ReverseProxy_API" enabled="true" stopProcessing="true">
                    <match url="^api/(.*)" />
                    <action type="Rewrite" url="https://example.document360.io/api/{R:1}" />
                    <serverVariables>
                        <set name="HTTP_requested_by" value="proxy" />
                        <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
                        <set name="HTTP_ACCEPT_ENCODING" value="" />
                    </serverVariables>
                </rule>
            </rules>
            <outboundRules>
                <rule name="RestoreAcceptEncoding" preCondition="NeedsRestoringAcceptEncoding">
                    <match serverVariable="HTTP_ACCEPT_ENCODING" pattern="^(.*)" />
                    <action type="Rewrite" value="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" />
                </rule>
        <rule name="RewriteLinksToSourceDomain1" preCondition="ResponseIsHtml">
                    <match filterByTags="None" pattern="^https://example.document360.io/(.*)" />
                    <action type="Rewrite" value="https://example.com/{R:1}" />
                </rule>
        <rule name="RewriteLinksToSourceDomain2" preCondition="ResponseIsHtml">
                    <match filterByTags="None" pattern="&quot;/help&quot;" />
                    <action type="Rewrite" value="&quot;/help&quot;" />
                </rule>
        <rule name="RewriteLinksToSourceDomain3" preCondition="ResponseIsHtml" patternSyntax="ECMAScript">
                    <match filterByTags="A" pattern="(.*)/docs/(.*)" />
                    <action type="Rewrite" value="/help/{R:2}" />
                </rule>
                <preConditions>
        <preCondition name="ResponseIsHtml">
                        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
                    </preCondition>
                    <preCondition name="NeedsRestoringAcceptEncoding">
                        <add input="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" pattern=" .+" />
                    </preCondition>
                </preConditions>
            </outboundRules>
        </rewrite>
    </system.webServer>  
</configuration>

The web.config file is located in your IIS root directory. Make sure to back up the file before making changes.

NOTE

  • If you are on KB Site 2.0 and wish to host your Knowledge base as a subfolder, you have to define the Subfolder path as well as the Site API path.

  • Replace /docs and /api with the exact values configured under Subfolder path and Site API path in the Document360 portal.


What happens next?

Once you have successfully configured the web server, your knowledge base site will be live in your custom subfolder/subdirectory.

However, the existing URL for your project will serve the requests.

For example, example.document360.io and example.com/help (if /help is your folder path) will point to the Knowledge base site.

Remember to replace example.document360.io and example.com/help with your domain. For example, yourcompany.document360.io and yourcompany.com/help.

This will cause duplicate content in Search engines (Google, Bing, and more). To prevent this, you will need to enable a URL redirect. Enabling a URL redirect prevents search engines like Google or Bing from indexing duplicate content, which can negatively impact your site's search rankings.

NOTE

To enable the redirect from example.document360.io to your custom subfolder example.com/help, please contact us at support@document360.com.


FAQs

What is Internet Information Services (IIS)?

IIS is a flexible, secure web server created by Microsoft for hosting websites, applications, and services on Windows. It supports protocols like HTTP, HTTPS, FTP, and more, making it widely used for web hosting and application deployment in Windows environments.

What is the Application Request Routing (ARR) module?

The ARR module is an IIS extension that enables load balancing, routing requests to different servers based on rules, and improving application performance.

What is the URL Rewrite module in IIS?

This IIS module allows you to create rules for modifying URLs, enabling custom paths for accessing content, and seamlessly redirecting users.

What is the purpose of the web.config file in IIS?

The web.config file stores configuration settings for applications running on IIS, such as URL rewrite rules, security settings, and server behavior.