[Owncloud] urlrouting

Roland van Laar roland at micite.net
Tue Mar 13 20:16:56 UTC 2012


Hello,

I added a url routing feature to owncloud.
For now only the root index and the files/index.php work.
lib/setup.php is also patched to setup a correct .htaccess when it's 
deployed behind Apache.

One of the reasons to add urlrouting is to allow for cleaner urls in 
owncloud.
It's now possible to remove the .php ending for example.
Another reason is increased security because with urlrouting only files
included in the url patterns are called from apache.
The other files, such as 3rd party libraries are now only accessible via 
code.

A dispatch.php is added which becomes the starting point for all non 
img,ajax, css and js requests.
dispatch.php contains the starting point for urls.

An example url patterns:
$urlPatterns = Array(
     Array('url' => '^/$', 'file' => 'index.php'),
     Array('url' => '^/index.php$', 'file' => 'index.php'),
     Array('url' => '^/files', 'dir_include' => 'files/'),
);

It's possible to include urls.php files in other directories via the
'dir_include' => dir_name syntax in the Array.

The code: 
https://gitorious.org/~rvanlaar/owncloud/rvanlaars-owncloud-urlrouting

What do you think?
Is this something that has the potential to be included in owncloud?

Regards,

Roland van Laar



More information about the Owncloud mailing list