How to Run Your Knowledge Base on a Subdirectory (e.g. /help)
Learn how to configure your server to load Helpjuice from a subdirectory, creating a more integrated experience for your users.
Table of Contents
Set Up Your Server Apache Setup Example NGINX Setup Example Troubleshooting & Authentication Tips Updating Your Knowledge Base TemplatesHosting your Knowledge Base on a subdirectory instead of a subdomain can improve SEO and create a more seamless experience between your website and Knowledge Base. Here's a comparison using yourDomain.com
and /help
as the subdirectory:
Description | URL Pattern |
---|---|
Regular Helpjuice subdomain | https://yourAccount.helpjuice.com |
Custom domain on a subdirectory | https://yourDomain.com/help |
Please note that in the example above, yourDomain
and help
are defined by you.
If you’re using Apache or NGINX, you can configure your server to load your Knowledge Base from a subdirectory. This guide provides step-by-step instructions to help you do that smoothly.
Set Up Your Server
Before getting started, make sure you:
- Use Apache or NGINX as your web server
- Have access to your server configuration files
- Can restart your server after applying changes
Once you're ready, follow these steps:
- Identify whether your server uses Apache or NGINX.
- Copy the appropriate configuration code from the examples below.
- Replace the highlighted values with your actual domain and preferred subdirectory.
- Paste the configuration into your server’s configuration file.
- Restart your server to apply the changes.
- Update your Knowledge Base templates.
Apache Setup Example
If you're using Apache, first enable the required modules:
sudo a2enmod proxy
sudo a2enmod proxy_http
Then restart Apache and add the following configuration to your virtual host or site config:
ProxyPass "/help" "https://yourAccount.helpjuice.com/"
ProxyPassReverse "/help" "https://yourAccount.helpjuice.com/"
NGINX Setup Example
If you're using NGINX, add the following configuration inside your server
block:
server {
listen 80;
large_client_header_buffers 4 16k;
server_name yourwebsite.com;
location ~ ^/help/?((?<=/).*)?$ {
proxy_set_header Host yourAccount.helpjuice.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For yourAccount.helpjuice.com;
proxy_pass https://yourAccount.helpjuice.com/$1$is_args$args;
proxy_read_timeout 90;
proxy_http_version 1.1;
}
}
Troubleshooting & Authentication Tips
If your setup isn’t working as expected, here are a few common issues to double-check:
-
HTTP Headers: If you're rewriting requests through a proxy, make sure the
Origin HTTP
header is set to your Helpjuice subdomain - e.g.,https://yourAccount.helpjuice.com
. -
Cookies: Some features require cookies to be passed correctly from Helpjuice to your end users. Ensure your server allows these cookies to be forwarded:
- _helpjuice_session_v2
- authorized_url_only_category_ids
- authorized_kb_encrypted_url_only
- authorized_url_only_question_id
- current_user_language
- segment_fields
-
Cookie Domains (Authentication): If your site runs on a different domain than
*.helpjuice.com
, you may need to rewrite the cookie domain in your proxy config. Refer to your server documentation for details:
Updating Your Knowledge Base Templates
After setting up your Knowledge Base to run on a subdirectory (like /help
), some updates will be required in your templates to ensure everything functions correctly.
This includes changes to internal links, form actions, meta tags, and any custom scripts that reference URLs or paths.
For a complete list of what needs to be updated - along with examples and implementation tips - refer to the following guide: Template Changes for Subdirectory Setup