Having Helpjuice Run On A Subdirectory Of Your Website (e.g. /help)
Learn how to set up Helpjuice to run on a subdirectory of your website, such as /help, to seamlessly integrate a knowledge base into your existing site structure.
Having your knowledge base reside on a subdirectory of your website, rather than subdomain is better for SEO, and can make your knowledge base look more 'integrated' into your website. Luckily, the set-up to make this happen with Helpjuice takes only a few minutes if you are using NGINX or Apache for your server.
Overview
In order to set up Helpjuice to run on a subdirectory (subdir) on your site, you may copy the below code, instructions are as follows:
- Determine if you are using Apache or Nginx
- Copy the appropriate code (if using Apache, use the Apache code, etc.)
- Make sure to replace all the yellow highlighted parts with your data. Red data is optional and only change if you want it elsewhere other than /help/
- Paste the code into your Server configuration file
- Restart your server
- Prepend /help (or the /subdirectory you've setup) to all the links in your KB via Templates in the Customize area (e.g.<a href="/help{{ category.to_language_url }}"></a>)
Authentication
NOTE: You may have to rewrite the cookie's domain too since your app is running in a different domain than *.helpjuice.com. You will have to check the docs for your proxy. If you're using Apache or NGINX, these links might help you set it up.
Apache setup example
If you are using Apache and want to run it on /help/:
First make sure you have the two required modules enabled:
sudo a2enmod proxy
sudo a2enmod proxy_http
Restart Apache for your new modules to load and add the following configuration:
ProxyPass "/help" "https://yourAccount.helpjuice.com/"
ProxyPassReverse "/help" "https://yourAccount.helpjuice.com/"
NGINX setup example
If you are on NGINX and want to run it on /help/
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
1. Forms (like article feedback and contact us) aren't working.
- If you're rewriting the requests, make sure that you're also changing the value of the Origin HTTP header to the account's subdomain in Helpjuice: https://yourAccount.helpjuice.com.
- Make sure that the cookies sent from our app are being forwarded to the browser. The form security depends on our session cookie. You should at least allow the following cookies:
- _helpjuice_session_v2: this one is the most important and will allow the feature to work.
- authorized_url_only_category_ids: used for URL-Only categories.
- authorized_kb_encrypted_url_only: used for encrypted KBs - if your KB is encrypted.
- authorized_url_only_question_id: used for questions with Shareable URLs.
- current_user_language: used to save user preferred language.
- segment_fields: if you use segmentation.