Fixing page not found issue with Horde nag (nag/t/save)


Published on December 31, 2013 by Marcus Rickert

Horde Nag Bugfix

1 min READ

As described in Horde ticket 11596 the nag application of the Horde Framework is the only application that requires rewrite rules.

When rewriting is not enabled (which is often the default) upon each edit action the user is redirected to a page ending in path nag/t/save which is not found on the server. To make nag work the following measures have to be taken:

  1. rewriting has to be enabled in the Apache webserver,
  2. local overwriting of .htaccess files has be allowed,
  3. the .htaccess has to be located in the nag subdirectory (e.g. /usr/share/horde/nag)
  4. in case the Horde base URL is not / the .htaccess file has to contain a RewriteBase tag denoting the base path of the URL.

This is how to do all the configuration in detail:

Enabling rewrite

Apache2 comes with a helper script called a2enmod which takes the name of the module as its parameter. So, in this case a

a2enmod rewrite

should be sufficient.

Permitting local overwrite of htaccess

The Apache2 configuration file for Horde should look like this (with /Horde being the base URL and /usr/share/horde being the installation root of the Horde web application):

Alias /Horde /usr/share/horde
<Directory /usr/share/horde>
   Options FollowSymLinks
   AllowOverride Limit FileInfo
<Directory>

Locating the .htaccess file for nag and optionally setting the rewrite base In the web directory of the nag application there has to be a local .htaccess file containing the following rewrite rules:

allow from all
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /Horde
    RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteCond   %{REQUEST_FILENAME}  !-d
    RewriteCond   %{REQUEST_FILENAME}  !-f
    RewriteRule ^(.*)$ rampage.php [QSA,L]
</IfModule>

The text highlighted in green is only required if the Horde application has a base URL different from /.

Wrapping up

The Apache server needs to be restarted after these changes:

service apache2 restart