Actions

Proposals/Done/Clean URLs

From Mahara Wiki

< Proposals‎ | Done(Redirected from Developer Area/Specifications in Development/Done/Clean URLs)

This feature has been developed for the University of the Arts, London, and has gone into core Mahara for version 1.6. See https://bugs.launchpad.net/mahara/+bug/1006634

Currently Mahara URLs use id parameters to identify users, groups, and pages (aka views). Many sites use 'clean' or 'friendly' URLs without ids or visible query parameters to make them more memorable and more aesthetically pleasing. An easily achievable first step for Mahara is to provide alternative clean URLs for the most visible, and most public user-generated pages: user profiles, group homepages, and portfolio pages owned by users and groups.

URL Format Examples

  • Profile page: http://example.org/user/mike
  • Group homepage: http://example.org/group/orange-group
  • User portfolio page: http://example.org/user/mike/mikes-cool-page
  • Group portfolio page: http://example.org/group/orange-group/an-interesting-group-page

URL id fields

Every user, group, and portfolio page will have a new 'urlid' field, restricted in length, and limited to lowercase characters, digits and hyphens (though this will be configurable). These can be chosen by the owner, with uniqueness enforced by the system so that no two users could have the same urlid field, no two groups can have the same urlid field, but portfolio pages by different owners *are* allowed to have the same url field (because it's just a fragment of the clean url in the format given above).

By default, these would be generated from usernames, group names, and page titles, by removing/substituting any illegal characters, and appending digits to enforce uniqueness if necessary. Once the url fields are created, it is up to the owners to maintain them - they will not be changed automatically when user/group/page names change.

The user portion of the clean urls will be editable on the Settings page, the group portion on the Edit Group page, and the Portfolio page portion in "Edit Title & Description" for a page. Pages owned by institutions will not have an editable url id; nor will pages owned by users/groups who have not set a profile/homepage url.

Rewrite rules

Webserver rewrite rules will be needed to map urls of the forms given above to the existing pages (user/view.php, group/view.php, view/view.php) with the urlids passed as query parameters. Because server administrators are required to set up rewrite rules and ensure they are working correctly, clean urls will not be configurable via the admin web UI. Enabling the option without the rewrites is dangerous because it will break a lot of links, and because detection of working rewrites is unreliable - there is no guarantee that the server is able to reach its own pages (by e.g. curl) using its configured wwwroot. Instead, configuration will happen in config.php, but with an admin page for initial generation of clean urls for existing data.

Instructions for the server admin will be available on this wiki at System_Administrator's_Guide/Clean_URL_Configuration.

Internal links

When the clean url option is enabled, Mahara will generate its internal links using the clean urls. Links to pages without urlids will be generated using the default id query parameter to identify the user, group, or page.