The base uri

This document exists to explain the number one problem people have with sabre/dav: setting a correct base uri.

Often after you set up any Cal-, Card- or WebDAV server, you may get an error like this:

  <s:message>File not found: sabredav in 'root'</s:message>

The actual filenames vary, but usually it will be something like that.

This is a short guide to help you figure out how to solve this.

What is the base URI

After you install sabredav, you may access your server through a url like these:

Any of those urls are valid, and it's completely up to you in which directory you run sabredav, or how you name your 'server file'. We strongly recommend against calling your server file index.php because this causes additional confusion. server.php is the best name.

After you set up this file, you need to tell sabredav what this url is.

Every example server file with contain a line such as this:


You need to make sure that whats specified as ... here, matches the base path to your server. For the first 4 examples we showed, the value would be this:


Note: urls are case-sensitive! Make sure that you use the exact case everywhere.

Why is this important?

In sabredav, a full url may look something like this:

SabreDAV needs to split this up in two components, which are these two:

SabreDAV only cares about the last part, but it can not easily figure out where the 'script' ends and where the the other path starts.

I would like to use clean urls

It's entirely possible to change this url:

And use urls like this instead:

But please note that the answer to this, is NOT changing the filename to index.php.

Instead, you must use 'url rewriting'.

You should only attempt this after you already have sabredav up and running with an ugly url, as this will reduce the number of potential issues.

Using rewriting for this is different depending on which webserver you use. For apache, you may have to create a virtual host, and add ruls such as this:

    RewriteEngine On
    # This makes every request go to server.php
    RewriteRule .* /server.php [L]

If you use .htaccess, it may instead look like this:

    RewriteEngine On
    # This makes every request go to server.php
    RewriteRule .* server.php [L]

However, configuration is completely different if you use nginx, IIS, or anything else. Consult your server's manual to figure out how.

After you've made this change, you can change server.php to make the baseUri look like this:


More information can also be found on the Web Servers page.