Using the Apache Web Server

This is a step by step walk through on how to enable Apache mod_rewrite with Ubuntu server in mind. Ushahidi requires it for clean URLs to work. That is, paths without "index.php" in the URL. It is targeted towards those who have much control and access to their web server. If you don't have access to the web server, you can request your system administrator to enable Apache mod_rewrite on your server.

Step 1

Test if Apache mod_rewrite is available in Apache2 by issuing the following command:

apache2ctl -M | grep rewrite

If mod_rewrite is enabled, the following is returned:

Syntax OK
rewrite_module (shared)

Otherwise, it means mod_rewrite needs to be enabled on the server. To do so, issue this command from the server's root account or (and preferred) using the sudo command (the sudo command is included below).

sudo a2enmod rewrite

Then restart Apache to load the newly enabled module. On Ubuntu, you can issue the command below to restart Apache:

sudo service apache2 restart

or use:

sudo /etc/init.d/apache2 restart

Step 2

The next step now is to edit your website's Apache configuration details so it allows configuration overrides by .htaccess file. The Apache configuration file could be either of these 000-default, a virtual host specific file, vhost.conf, httpd.conf, or apache2.conf and usually with Ubuntu, you can find it at /etc/apache2/sites-enabled/ or on other systems its found at /etc/httpd/

In that file, look for the section for your website that reads like it is shown below.

<Directory /var/www/>
  Options Indexes FollowSymLinks MultiViews
  AllowOverride None
  Order allow,deny
  allow from all
</Directory>

Now change

AllowOverride None

to

AllowOverride All

If it is already set to AllowOverride All then leave it as it is. After, restart Apache with the command stated earlier.

That's it. Your Ushahidi deployment will now allow clean URLs. Log back into your instance to make sure this setting is enabled.

Alternative: .htaccess edits

The above method is recommended, but should you not have access to the Apache configuration files or prefer not to make those edits, you can edit the .htaccess file in the root of the Ushahidi application files. Add these two lines to the .htaccess file.

AllowOverride All
AccessFileName .htaccess