lighttpd mod_rewrite

Discuss PivotX 2.0.x here. Non-PivotX related discussions go in The Drain.

lighttpd mod_rewrite

Postby insanum » Sat May 15, 2010 5:52 pm

I've converted PivotX's example.htaccess to rewrite rules that can be used by lighttpd. This is only for PivotX and will not handle older Pivot permalinks. Note that if your PivotX install is not located directly under your webroot then you'll have to modify accordingly (very simple). http://insanum.com/blog/2010/05/15/pivotx-with-lighttpd-mod-rewrite

Code: Select all
url.rewrite-once = (
  "^/archive/(.*)$" => "/index.php?uri=$1=archive",
  "^/([0-9]{4})[/-](.*)/trackback/?$" => "/index.php?trackback&uri=$1/$2&rewrite=archive",
  "^/entry/(.*)/trackback/?$" => "/index.php?trackback&e=$1&rewrite=entry",
  "^/([0-9]{4})[/-](.*)$" => "/index.php?uri=$1/$2&rewrite=archive",
  "^/entry/(.*)$" => "/index.php?e=$1&rewrite=entry",
  "^/page/(.*)$" => "/index.php?uri=$1&rewrite=page",
  "^/tag/(.*)$" => "/index.php?t=$1&rewrite=tag",
  "^/tags/?$" => "/index.php?x=tagpage",
  "^/search/(.*)$" => "/index.php?q=$1&rewrite=search",
  "^/search$" => "/index.php?rewrite=search",
  "^/visitor(/([^/]*)/?)?$" => "/index.php?x=visitorpage&w=$2",
  "^/category/(.*)$" => "/index.php?c=$1&rewrite=category",
  "^/weblog/(.*)$" => "/index.php?w=$1&rewrite=archive",
  "^/author/(.*)$" => "/index.php?u=$1&rewrite=author",
  "^/browse/(.*)$" => "/index.php?o=$1&rewrite=offset",
  "^/rss(/([^/]*)/?)?$" => "/index.php?feed=rss&w=$2",
  "^/atom(/([^/]*)/?)?$" => "/index.php?feed=atom&w=$2",
  "^/(([a-z0-9_-]+)(/([a-z0-9_-]*))?)$" => "/index.php?uri=$1&rewrite=page",
)
insanum
 
Posts: 3
Joined: Sat May 15, 2010 2:56 am

Re: lighttpd mod_rewrite

Postby ilvalle » Sun May 16, 2010 8:55 am

Good work! It seems to work on my site :-). (www.masia5.it)
I see that you have forgot the rewriting for the sitemap url

paolo
ilvalle
 
Posts: 26
Joined: Fri Apr 23, 2010 3:15 pm

Re: lighttpd mod_rewrite

Postby insanum » Sun May 16, 2010 5:28 pm

Ah yes. Simply add the following to the url.rewrite-once block:

Code: Select all
"^/sitemap.xml$" => "/index.php?xml_sitemap"
insanum
 
Posts: 3
Joined: Sat May 15, 2010 2:56 am


Return to 2.x Discussion

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron