Apache HTTP server

Prev Next
Professional
Business
Enterprise






The Apache HTTP web server, also known as Apache server, is a free, open-source web server. Apache is highly flexible and customizable. You can easily enable or turn off various functionalities.

NOTE

Replace the example domain with your document360 provided domain/custom domain.

  • Example domain represented using example.document360.io

  • Subfolder/subdirectory path (/v1) represented as example.document360.io/v1

  • Subfolder/subdirectory home page path (/help) represented as example.document360.io/help

Setting up a sub folder path

Ensure the following Apache server modules are enabled. These modules are part of the Apache server installation.
• proxy
• proxy_http
• headers
• substitute
• proxy_html
Run the following bash command to enable the modules:

    sudo a2enmod proxy proxy_http headers substitute proxy_html

Home page

  1. Configure the following Virtual Host configuration location blocks.

For example,

  • Location Block - Proxy all requests where the path starts from "/help".

This block will proxy requests for the home page.

<Location /help>
   ProxyPreserveHost off
   RequestHeader set Host example.document360.io
   RequestHeader set requested-by proxy
   RequestHeader unset Accept-Encoding
   ProxyPass https://example.document360.io/v1
   ProxyPassReverse https://example.document360.io/v1



   AddOutputFilterByType SUBSTITUTE text/html
   substitute 's|href="/docs|href="/help|ni'
   substitute 's|href="/v1/docs|href="/help|ni'
   substitute 's|href="https://example.document360.io/docs|href="https://docs.example.com/help|ni'
</Location>

Redirect block to fix article preview links for sub folder hosting

  1. The article preview links in Document360 portal contain the workspace and language slug in the URL.

For example,

  • Article URL: docs.example.com/getting-started

  • Preview links in the Knowledge base portal: docs.example.com/v1/en/getting-started

You can either add one more location block to handle /v1/en path, (or) have a redirect set from /v1/en to /.

Please refer to the code snippet below for setting the redirect:

RewriteEngine on
RewriteRule ^v1/en$ / [R=301,L,NC]

You should install the rewrite module for the redirection to work. Use the following code to install the rewrite module.

sudo a2enmod rewrite

Article/Category pages

  1. Configure the following Virtual Host configuration location blocks.

For example,

  • Location Block - Proxy all requests where path starts from "/help/"

This block will proxy requests for all the article/category pages.

<Location /help/>
   ProxyPreserveHost off
   RequestHeader set Host example.document360.io
   RequestHeader set requested-by proxy
   ProxyPass https://example.document360.io/docs/
   ProxyPassReverse https://example.document360.io/docs/



   AddOutputFilterByType SUBSTITUTE text/html
   substitute 's|href="/docs|href="/help|ni'
   substitute 's|href="/v1/docs|href="/help|ni'
   substitute 's|href="https://example.document360.io/docs|href="https://docs.example.com/help|ni'
</Location>
  1. Restart the Apache server

For example, If you are using Nginx on Linux, then use the command
$ sudo systemctl restart nginx

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.


Sitemap generation

NOTE

Replace the example domain with your document360 provided domain/custom domain.

  • Example domain represented using example.document360.io

  • The sitemap prefix remains the same except for the language code (en, fr, de, etc.)  example.document360.io/sitemap.xml.en

<Location /sitemap.xml.en>
    RequestHeader set Host example.document360.io
    RequestHeader set requested-by proxy
    ProxyPass https://example.document360.io/sitemap.xml.en
    ProxyPassReverse https://example.document360.io/sitemap.xml.en
</Location>

What happens next?

Once you have successfully configured the web server, your knowledge base site is live on your custom subfolder/subdirectory.

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

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

This will cause duplicate content in Search engines (Google, Bing, etc.). For this, you will need to enable a URL redirect.

NOTE

To enable the redirect from example.document360.io to example.com/docs, please contact us at support@document360.com.