Mailing List Archive

caldav.php -> index.php
Hello everyone,

Would you consider it reasonable to rename caldav.php to index.php. This would, in my opinion, simplify the calendar domain - i. e. one could have -

http://calendars.domain.tld/user/home/

instead of -

http://calendars.domain.tld/caldav.php/user/home/

All the best, Iv
caldav.php -> index.php [ In reply to ]
On Tue, 2010-09-07 at 22:07 +0200, Iv Ray wrote:
> Hello everyone,
>
> Would you consider it reasonable to rename caldav.php to index.php. This would, in my opinion, simplify the calendar domain - i. e. one could have -
>
> http://calendars.domain.tld/user/home/
>
> instead of -
>
> http://calendars.domain.tld/caldav.php/user/home/

Hi Iv,

I don't think it would actually work like you expect because Apache (or
whatever) would be looking for a folder called /user rather than a PHP
script.

However you can do this with an Apache rewrite rule like:


RewriteRule ^(.*)$ /caldav.php$1 [NC,L]


I typically surround that with a bunch more sugar, like:

RewriteEngine On

# Not if it's the root URL
RewriteCond %{REQUEST_URI} !^/$

# Not if it explicitly specifies a .php program, stylesheet or image
RewriteCond %{REQUEST_URI} !\.(php|css|png|gif|js|jpg|otf)

# Not if it is the docs alias above.
RewriteCond %{REQUEST_URI} !^/docs

# rewrite /blah/xyz to /caldav.php/blah/xyz
RewriteRule ^(.*)$ /caldav.php$1 [NC,L]

# Special rewrite for Apple users
RewriteRule ^/principals/users(.*)$ /caldav.php$1 [NC,L]


DAViCal understands when this happens and should adjust the paths that
it hands out to fit with the ones it is accessed as, so if a client
does:

PROPFIND /caldav.php/blah/home/

The URLs in the response will be /caldav.php/blah/home/...

Whereas if the request is for:

PROPFIND /blah/home/

The URLs in the response will be /blah/home/...


Cheers,
Andrew McMillan.

--
------------------------------------------------------------------------
andrew (AT) morphoss (DOT) com +64(272)DEBIAN
Powering the .NZ namespace with Open Source Software
------------------------------------------------------------------------