Serving .ics files from a webserver

If you store static ical files with a .ics extension on a webserver and would like to give users the ability to click a link and add the events to their calendars, you may need to jump a couple hurdles.

If the server hosting the files doesn’t recognize the vcal format, it will simply display the .ics files as plain text. To prevent this, you can try one of the following:

  1. Have your server admin add the vcal MIME type to the server settings.
  2. Use a scripting language like PHP that will allow you to set the header of the ics files to download. There are plenty of tutorials on how to do this.
  3. On Apache, put the ics files in a dedicated folder with an .htaccess file. Your htaccess file should have the following:


<FilesMatch "\.(ics)$">
#ForceType text/x-vCalendar
AddType text/x-vCalendar .ics
#Header set Content-Disposition "attachment; filename=mycal.ics"
</FilesMatch>

And that’ll do it!

Share and Enjoy:
  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • LinkedIn
  • Technorati
  • Tumblr
This entry was posted in Web Design. Bookmark the permalink.

Comments are closed.