Loading...
 
Skip to main content

History: Lighttpd Clean URLs

Source of version: 7 (current)

Copy to clipboard
            ^ 2013-06-19 A PHP route.php file now replaces the rewrite rules from _htaccess http://sourceforge.net/p/tikiwiki/code/44661/ for Tiki11 so the instructions below can be vastly simplified. We are looking for a volunteer to do this and to commit a default to the main code base. ^ 

! Clean URLs with Lighttpd
Draft rewrite rules for Tiki on lighttpd. This is a starting point for testing and further development of the rules. Please adapt to your site and test thoroughly that they work and are complete; and use at your own risk.

{CODE(caption="Add to lighttpd configuration file" wrap="1")}$HTTP["host"] =~ "(www.)?example.com" {
  url.rewrite-once += (

    # TIKI
    # Allow all normal files
    "^/.*\.(css|gif|jpg|png|php|html|js|htm|shtml|cgi|sql|phtml|txt|ihtml|ico|swf)(\?.*)?$" => "$0",

    # direct one-word access - is the / needed?
    "^(img\/trackers\/.*)" => "$1",
    "^calendar$" => "/tiki-calendar.php",
    "^articles$" => "/tiki-view_articles.php",
    "^blogs$" => "/tiki-list_blogs.php",

    # The following supports up to seven merged calendars; most to least.
    "^cal([0-9]+),([0-9]+),([0-9]+),([0-9]+),([0-9]+),([0-9]+),([0-9]+)" => "/tiki-calendar.php?calIds[]=$1&calIds[]=$2&calIds[]=$3&calIds[]=$4&calIds[]=$5&calIds[]=$6&calIds[]=$7",
    "^cal([0-9]+),([0-9]+),([0-9]+),([0-9]+),([0-9]+),([0-9]+)" => "/tiki-calendar.php?calIds[]=$1&calIds[]=$2&calIds[]=$3&calIds[]=$4&calIds[]=$5&calIds[]=$6",
    "^cal([0-9]+),([0-9]+),([0-9]+),([0-9]+),([0-9]+)" => "/tiki-calendar.php?calIds[]=$1&calIds[]=$2&calIds[]=$3&calIds[]=$4&calIds[]=$5",
    "^cal([0-9]+),([0-9]+),([0-9]+),([0-9]+)" => "/tiki-calendar.php?calIds[]=$1&calIds[]=$2&calIds[]=$3&calIds[]=$4",
    "^cal([0-9]+),([0-9]+),([0-9]+)" => "/tiki-calendar.php?calIds[]=$1&calIds[]=$2&calIds[]=$3",
    "^cal([0-9]+),([0-9]+)" => "/tiki-calendar.php?calIds[]=$1&calIds[]=$2",
    "^cal([0-9]+)" => "/tiki-calendar.php?calIds[]=$1",
    "^categories$" => "/tiki-browse_categories.php",
    "^chat$" => "/tiki-chat.php",
    "^contact$" => "/tiki-contact.php",
    "^directories$" => "/tiki-directory_browse.php",
    "^dirlink([0-9]+)" => "/tiki-directory_redirect.php?siteId=$1",
    "^faqs$" => "/tiki-list_faqs.php",
    "^filelist$" => "/tiki-list_file_gallery.php",
    "^forums$" => "/tiki-forums.php",
    "^galleries$" => "/tiki-galleries.php",
    "^login$" => "/tiki-login_scr.php",
    "^logout$" => "/tiki-logout.php",
    "^register$" => "/tiki-register.php",
    "^my$" => "/tiki-my_tiki.php",
    "^newsletters$" => "/tiki-newsletters.php",
    "^quizzes$" => "/tiki-list_quizzes.php",
    "^sheets$" => "/tiki-sheets.php",
    "^stats$" => "/tiki-stats.php",
    "^surveys$" => "/tiki-list_surveys.php",
    "^trackers$" => "/tiki-list_trackers.php",
    "^users$" => "/tiki-list_users.php",
    "^userinfo$" => "/tiki-view_tracker_item.php?view=+user&cookietab=2",

    # access any object by its numeric identifier
    "^/article([0-9]+)\-.*(&comzone=.*)$" => "/article$1$2",
    "^/article([0-9]+)\-.*$" => "/tiki-read_article.php?articleId=$1",
    #"^/blog([0-9]+)\-.*$" => "/blog$1",
    "^/blogpost([0-9]+)\-.*$" => "/blogpost$1",
    "^/article([0-9]+)(.*)" => "/tiki-read_article.php?articleId=$1$2",
    "^/art([0-9]+)(.*)" => "/tiki-read_article.php?articleId=$1$2",
    "^/cat([0-9]+)\-?[^&]*(.*)" => "/tiki-browse_categories.php?parentId=$1$2",
    "^/blog([0-9]+)(.*)" => "/tiki-view_blog.php?blogId=$1$2",
    "^/blogpost([0-9]+)(.*)" => "/tiki-view_blog_post.php?postId=$1$2",
    "^/browseimage([0-9]+)(.*)" => "/tiki-browse_image.php?imageId=$1$2",
    "^/directory([0-9]+)(.*)" => "/tiki-directory_browse.php?parent=$1$2",
    "^/faq([0-9]+)(.*)" => "/tiki-view_faq.php?faqId=$1$2",
    "^/file([0-9]+)(.*)" => "/tiki-list_file_gallery.php?galleryId=$1$2",
    "^/dl([0-9]+)(.*)" => "/tiki-download_file.php?fileId=$1$2",
    "^/thumbnail([0-9]+)(.*)" => "/tiki-download_file.php?fileId=$1&thumbnail$2",
    "^/display([0-9]+)(.*)" => "/tiki-download_file.php?fileId=$1&display$2",
    "^/preview([0-9]+)(.*)" => "/tiki-download_file.php?fileId=$1&preview$2",
    "^/forum([0-9]+)(.*)" => "/tiki-view_forum.php?forumId=$1$2",
    "^/gallery([0-9]+)(.*)" => "/tiki-browse_gallery.php?galleryId=$1$2",
    "^/img([0-9]+)(.*)" => "/show_image.php?id=$1$2",
    "^/image([0-9]+)(.*)" => "/show_image.php?id=$1$2",
    "^/imagescale([0-9]+)/([0-9]+)(.*)" => "/show_image.php?id=$1&scalesize=$2$3",
    "^/newsletter([0-9]+)(.*)" => "/tiki-newsletters.php?nlId=$1$2&info=1",
    "^/quiz([0-9]+)(.*)" => "/tiki-take_quiz.php?quizId=$1$2",
    "^/survey([0-9]+)(.*)" => "/tiki-take_survey.php?surveyId=$1$2",
    "^/tracker([0-9]+)(.*)" => "/tiki-view_tracker.php?trackerId=$1$2",
    "^/item([0-9]+)(.*)" => "/tiki-view_tracker_item.php?itemId=$1$2",
    "^/int([0-9]+)(.*)" => "/tiki-integrator.php?repID=$1$2",
    "^/sheet([0-9]+)(.*)" => "/tiki-view_sheets.php?sheetId=$1$2",
    "^/poll([0-9]+)(.*)" => "/tiki-poll_form.php?pollId=$1$2",
    "^/wiki-([A-Za-z0-9]+)" => "/tiki-index.php?=$1",
    "^/-([A-Za-z0-9]+)" => "/tiki-index.php?=$1",
    "^/show:(~?)(.+)$" => "/tiki-slideshow.php?=$1$2",
    "^/user([0-9]+)(.*)" => "/tiki-user_information.php?userId=$1$2",
    "^(lib/wiki3d/.+\.jar)$" => "$1",

    "^/(.+)$" => "/tiki-index.php?=$1"
  )
}


$HTTP["host"] == "www.example.com" {
  url.redirect  = (
    "^/(.*)" => "http://example.com/$1"
  )
}

}

{CODE}

!! Related
* ((Operating System independence))
* ((htaccess|.htaccess))
* http://en.wikipedia.org/wiki/Lighttpd

-=Alias=-

(alias(lighttpd))