Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Rewrite-Rule for LightHttpd

edited October 2006 in Vanilla 1.0 Help
Hi,

because I think lighthttpd is a great Webserver here is the Rewrite-Rule for lighty:

$HTTP["host"] == "your.domain.tld" {
server.document-root = "/path/to/docroot/"
url.rewrite-once = ( "^/discussions$" => "index.php",
"^/discussions/$" => "index.php",
"^/discussions/([0-9]+)$" => "index.php?page=$1",
"^/discussions/([0-9]+)/$" => "index.php?page=$1",
"^/([0-9]+)$" => "index.php?CategoryID=$1",
"^/([0-9]+)/$" => "index.php?CategoryID=$1",
"^/([0-9]+)/([0-9]+)$" => "index.php?CategoryID=$1&page=$2",
"^/([0-9]+)/([0-9]+)/$" => "index.php?CategoryID=$1&page=$2",
"^/discussion/([0-9]+)/([0-9]+)/(.*)$" => "comments.php?DiscussionID=$1&page=$2",
"^/discussion/([0-9]+)/([0-9]+)/(.*)/$" => "comments.php?DiscussionID=$1&page=$2",
"^/discussion/([0-9]+)/(.*)$" => "comments.php?DiscussionID=$1",
"^/discussion/([0-9]+)/(.*)/$" => "comments.php?DiscussionID=$1",
"^/discussion/([0-9]+)/([0-9]+)$" => "comments.php?DiscussionID=$1&page=$2",
"^/discussion/([0-9]+)/([0-9]+)/$" => "comments.php?DiscussionID=$1&page=$2",
"^/discussion/([0-9]+)$" => "comments.php?DiscussionID=$1",
"^/discussion/([0-9]+)/$" => "comments.php?DiscussionID=$1",
"^/categories/$" => "categories.php",
"^/account/$" => "account.php",
"^/account/([0-9]+)$" => "account.php?u=$1",
"^/account/([0-9]+)/$" => "account.php?u=$1",
"^/search/$" => "search.php",
"^/search/([0-9]+)$" => "search.php?page=$1",
"^/search/([0-9]+)/$" => "search.php?page=$1",
"^/search/saved/([0-9]+)$" => "search.php?SearchID=$1",
"^/search/saved/([0-9]+)/$" => "search.php?SearchID=$1",
"^/search/saved/([0-9]+)/([0-9]+)$" => "search.php?SearchID=$1&page=$2",
"^/search/saved/([0-9]+)/([0-9]+)/$" => "search.php?SearchID=$1&page=$2",
"^/post/$" => "post.php",
"^/post/([0-9]+)$" => "post.php?CommentID=$1",
"^/post/([0-9]+)/$" => "post.php?CommentID=$1",
"^/post/category/([0-9]+)$" => "post.php?CategoryID=$1",
"^/post/category/([0-9]+)/$" => "post.php?CategoryID=$1",
"^/settings/$" => "settings.php",
"^/people/$" => "people.php",
"^/(discussions|categories|search|post|settings|people|[0-9]+)/(extensions|themes|images|ajax)/(.*)" => "$2/$3",
"^/(discussions|categories|search|post|settings|people|[0-9]+)/(account.php|categories.php|comments.php|extension.php|index.php|people.php|post.php|search.php|settings.php)" => "$2",
"^/discussion/([0-9]+/){1,2}[^/]*/(extensions|themes|images|ajax)/(.*)" => "$2/$3",
"^/discussion/([0-9]+/){1,2}[^/]*/(account.php|categories.php|comments.php|extension.php|index.php|people.php|post.php|search.php|settings.php)" => "$2",
"^/(discussions|account|search|post|[0-9]+)/.+/(extensions|themes|images|ajax)/(.*)" => "$2/$3",
"^/(discussions|account|search|post|[0-9]+)/.+/(account.php|categories.php|comments.php|extension.php|index.php|people.php|post.php|search.php|settings.php)" => "$2")
}
The source is the .htaccess from Mark's Friendly Urls 1 Plugin. Just deleted all not necessary lines and edited in VIM with
':%s/\^\(.*\)/\^\/\1/g'
and
':%s/^RewriteRule\ \([^\ ]*\)\ \([^\ ]*\)\ .*/\t\t\t  "\1" => "\2",/'
..thats it, have fun with lighty! :)

Comments

  • Options
    lechlech Chicagoland
    Hey defel, This is great, I would suggest wrapping it up into a package with instructions and loading it up into the http://lussumo.com/addons/ page for others to find instead of it getting lost here within all the discussions. Name it "Friendly URLs for LightHttpd", the lighthttpd users will thank you! :)
  • Options
    What is LightHttpd? I'm gonna do some sleuth work but this seems interesting.
  • Options
    lechlech Chicagoland
    LightHttpd is just another http server, like Apache and others out there.
  • Options
    Just found it useful, but there exist some small mistakes. Here is the fixed one.
    url.rewrite-once = (    "^/discussions/?$" => "index.php",
    "^/discussions/([0-9]+)/?$" => "index.php?page=$1",
    "^/([0-9]+)/?$" => "index.php?CategoryID=$1",
    "^/([0-9]+)/([0-9]+)/?$" => "index.php?CategoryID=$1&page=$2",
    "^/discussion/([0-9]+)/([0-9]+)/(.*)/?$" => "comments.php?DiscussionID=$1&page=$2",
    "^/discussion/([0-9]+)/(.*)/?$" => "comments.php?DiscussionID=$1",
    "^/discussion/([0-9]+)/([0-9]+)/?$" => "comments.php?DiscussionID=$1&page=$2",
    "^/discussion/([0-9]+)/?$" => "comments.php?DiscussionID=$1",
    "^/categories/?$" => "categories.php",
    "^/account/?$" => "account.php",
    "^/account/([0-9]+)/?$" => "account.php?u=$1",
    "^/account/(.*)$" => "account.php$1",
    "^/search/?$" => "search.php",
    "^/search/([0-9]+)/?$" => "search.php?page=$1",
    "^/search/saved/([0-9]+)/?$" => "search.php?SearchID=$1",
    "^/search/saved/([0-9]+)/([0-9]+)/?$" => "search.php?SearchID=$1&page=$2",
    "^/post/?$" => "post.php",
    "^/post/([0-9]+)/?$" => "post.php?CommentID=$1",
    "^/post/category/([0-9]+)/?$" => "post.php?CategoryID=$1",
    "^/settings/(.*)$" => "settings.php$1",
    "^/people/$" => "people.php",
    "^/(discussions|categories|search|post|settings|people|[0-9]+)/(extensions|themes|images|ajax)/(.*)" => "$2/$3",
    "^/(discussions|categories|search|post|settings|people|[0-9]+)/(account.php|categories.php|comments.php|extension.php|index.php|people.php|post.php|search.php|settings.php)" => "$2",
    "^/discussion/([0-9]+/){1,2}[^/]*/(extensions|themes|images|ajax)/(.*)" => "$2/$3",
    "^/discussion/([0-9]+/){1,2}[^/]*/(account.php|categories.php|comments.php|extension.php|index.php|people.php|post.php|search.php|settings.php)" => "$2",
    "^/(discussions|account|search|post|[0-9]+)/.+/(extensions|themes|images|ajax)/(.*)" => "$2/$3",
    "^/(discussions|account|search|post|[0-9]+)/.+/(account.php|categories.php|comments.php|extension.php|index.php|people.php|post.php|search.php|settings.php)" => "$2"
    )
  • Options
    @leech Thanks for the Feedback, will pack an Addon now .. it's done: http://lussumo.com/addons/?PostBackAction=AddOn&AddOnID=98 @JoshuaJenkins LightHTTPd is a small and fast Webserver with a clean config (in opposition to Apache ;) ) and nice Modules, dont tested it in a production-environment until now, but I did setup my new Server and will move the Forum in the next few days .. @kdekid Many thanks for the fixes :) I packed this version as extension ..
  • Options
    Very sweet. Thanks for sharing.
  • Options
    How fix for non-English character, like öçşğüı.
This discussion has been closed.