Removing /public/index.php from URL-s

By default, activeCollab uses URL-s containing /public/index.php in order to avoid having mod_rewrite as a system requirement. If, from some reason, this system does not work (for instance, you receive "No input file specified error") or you just want to have a 100% clean URL, please follow the instructions bellow to implement it and disable default URL-s.

First create a file named .htaccess in the folder where activeCollab is installed, and add these lines:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Options -Indexes
<IfModule mod_rewrite.c>
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^(.+) - [PT,L]

  RewriteRule ^assets/(.*)$ public/assets/$1 [L]
  RewriteRule ^avatars/(.*)$ public/avatars/$1 [L]
  RewriteRule ^logos/(.*)$ public/logos/$1 [L]
  RewriteRule ^notebook_covers/(.*)$ public/notebook_covers/$1 [L]
  RewriteRule ^template_covers/(.*)$ public/template_covers/$1 [L]
  RewriteRule ^projects_icons/(.*)$ public/projects_icons/$1 [L]
  RewriteRule ^proxy.php$ public/proxy.php [QSA,L]
  RewriteRule ^sync.php$ public/sync.php [QSA,L]
  RewriteRule ^$ public/index.php [QSA,L]
  RewriteRule ^(.*) public/index.php?path_info=$1 [QSA,L]
</IfModule>

Now open config/config.php and update the value of ROOT_URL to exclude /public from the link. For example, if the original URL was:

1
define('ROOT_URL', 'http://projects.example.com/public');

or:

1
const ROOT_URL = 'http://projects.example.com/public';

Edit this line, and set it to:

1
const ROOT_URL = 'http://projects.example.com';

After you have made this declaration (not earlier, it will not work), add the following three lines:

1
2
3
define('URL_BASE', ROOT_URL . '/');
define('ASSETS_URL', ROOT_URL . '/public/assets');
define('PATH_INFO_THROUGH_QUERY_STRING', false);

Finally, clear the cache folder, so that activeCollab can pick up new URL-s instead of using the old, cached ones. To clear the cache, use your FTP client and navigate to the /cache folder of your activeCollab and remove all .php files that are stored there.

Rewrite Rules

If you are using IIS7 or nginx server, here are some tips that can help you set up clean URL-s:

  • for IIS7 users - IIS7 rewrite module features a tool that lets you easily import Apache mod_rewrite rules. Please check this article for more details.
  • for nginx users: please use the following rules to set up clean URL-s in your activeCollab:
1
2
3
4
5
6
7
8
9
10
if (!-e $request_filename) {
    rewrite ^avatars/(.*)$ /public/avatars/$1 last;
    rewrite ^logos/(.*)$ /public/logos/$1 last;
    rewrite ^notebook_pages/(.*)$ /public/notebook_pages/$1 last;
    rewrite ^projects_icons/(.*)$ /public/projects_icons/$1 last;
    rewrite ^proxy.php$ public/proxy.php last;
    rewrite ^sync.php$ public/sync.php last
    rewrite ^$ /public/index.php last;
    rewrite ^(.*) /public/index.php?path_info=$1 last;
}

To test your new setup, navigate through your activeCollab and check if the links are updated.