Mounting the chat on Apache

The .htaccess that ships with the package sends every address of the chat to its front controller.

On Apache, the .htaccess that ships with the package sends every address of the chat’s folder to its front controller. You copied it in step 3 of Installing.

01 · The .htaccess

This is public/opensolr-chat/.htaccess, a copy of vendor/opensolr/chat-bot-client/examples/apache.htaccess:

Options -Indexes

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L,QSA]
</IfModule>

<IfModule mod_setenvif.c>
    SetEnvIf Request_URI "/chat$" no-gzip=1 dont-vary=1
</IfModule>
  • Options -Indexes turns off directory listings.
  • The rewrite rule sends every address under the folder to index.php: the widget, its settings, the chat itself and the admin.
  • The SetEnvIf line turns compression off for the chat’s answers, so they arrive word by word.
02 · What Apache needs
  1. mod_rewrite enabled. On Debian and Ubuntu: sudo a2enmod rewrite, then reload Apache.
  2. .htaccess allowed in that folder: AllowOverride FileInfo Options, or AllowOverride All, in your Apache configuration.
  3. The file named .htaccess, with the dot, next to index.php.

If your Apache does not read .htaccess in that folder, put the same lines in a <Directory> block of your virtual host.

03 · PHP-FPM or mod_php
  • With PHP-FPM behind Apache, one more line in your virtual host decides whether answers arrive word by word: see Streaming through your server.
  • With mod_php, nothing more than the .htaccess.

Check it: https://your-site/opensolr-chat/widget.js must open as JavaScript. A 404 means the rewrite does not reach the folder: see Troubleshooting.

Install on your server

The Opensolr Chat Bot Client is open source and MIT licensed. Questions about your Opensolr account, index or plan go to opensolr.com/contact; questions about the client itself belong on GitHub.

Opensolr Chat Bot Documentation