by mars on 2005-08-13 1 Comment
filed in Work with tags

Update: Saturday, 20th August 2005 I have been unable to make these rewrite rules work fully. Experimentation has lead to variations that fix one rewrite problem at the expense of breaking a different facet of the URL schema. Gallery's mixing of query strings with rewritten URL's seems to be the core issue. So, let me know if you happen to solve the problem completely!

Update: Monday, 22nd August 2005 I've simply disabled URL rewriting in Gallery's config.php file to permit Gallery to function under Lighttpd:

$gallery->app->feature["rewrite"] = 0;

Update: Monday, 2nd January 2006 From David Lutz:

I decided to continue banging my head on the rewrite wall for a little longer and came up with a set of rules that do an excellent job for me. If you are interested in giving them a try or posting them on your site here they are:

# URL Rewrite
url.rewrite = (

# Gallery v1: Pass any request for something in selected sub-dirs
  "^/gallery/(css|docs|images|java|js|setup|skins|tools)/(.*)$" => "/gallery/$1/$2",

# Gallery v1: Pass any request for a .php file in the main gallery dir
  "^/gallery/([^.\?/]+.php(?:\?.*)?)" => "/gallery/$1",

# Gallery v1: Rewrite album/index w/optional args
  "^/gallery/([^.\?/]+)/([0-9]+)(?:\?(.*))?" => "/gallery/view_photo.php?set_albumName=$1&index=$2&$3",

# Gallery v1: Rewrite album/id w/optional args
  "^/gallery/([^.\?/]+)/([A-Za-z_0-9\-]+)(?:\?(.*))?" => "/gallery/view_photo.php?set_albumName=$1&id=$2&$3",

# Gallery v1: Rewrite album w/optional args
  "^/gallery/([^.\?/]+)(?:\?(.*))?" => "/gallery/view_album.php?set_albumName=$1&$2",
)

To get Gallery running under the Lighttpd/PHP-FastCGI web server is no problem, except you'll soon find that the Apache RewriteRules to make pretty URL's don't work!

I figured it out, and so here's the answer.

This is modeled after my own setup, where Gallery lives in the "/gallery/" sub-directory of my web server document root.

Apache

Here are the original mod_rewrite RewriteRules for Gallery from the ".htaccess" file that it generates during initial set-up:

RewriteEngine On
RewriteBase /gallery/

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.\?/]+)/([0-9]+)$   /gallery/view_photo.php?set_albumName=$1&index=$2 [QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.\?/]+)/([A-Za-z_0-9\-]+)$ /gallery/view_photo.php?set_albumName=$1&id=$2 [QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.\?/]+)/$           /gallery/$1 [R]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.\?/]+)$            /gallery/view_album.php?set_albumName=$1 [QSA]

Lighttpd

Here are the translated url.rewrite directives for Gallery. They go in the "lighttpd.conf" file. Make sure these very specific rewrites come before more general rewrites that you may already have:

url.rewrite = ( 
  "^/gallery/albums/(.*)$" => "/gallery/albums/$1",
  "^/gallery/([^.\?/]+)/([0-9]+)" => "/gallery/view_photo.php?set_albumName=$1&index=$2",
  "^/gallery/([^.\?/]+)/([A-Za-z_0-9\-]+)" => "/gallery/view_photo.php?set_albumName=$1&id=$2",
  "^/gallery/([^.\?/]+)" => "/gallery/view_album.php?set_albumName=$1",
  "^/gallery/?$" => "/gallery/index.php",
)

Updated 2005-08-17: Updates to make these work better. Still not perfect

1 Response to “Gallery URL Rewriting in Lighttpd”

berksad commented
2010-07-13 at 08:51 AM
  • на интернет-доски 10$ на 10 тысяч или 15$ на 20 тысяч
  • в каталоги (белые) сайтов 10$ в 6 тысяч
  • на форумы 20$ на 30 тысяч
  • на 60 тысяч 40$
  • на 100 тысяч 50$
  • рассылка вручную на любые сайты 0.2$ за один сайт сбор сайтов входит в стоимость минимальный заказ 50 размещений.
  • рассылка на сайты определенной тематики 60$ повторные рассылки 20$
  • Имэйл рассылки по определенной теме - 100$
  • разослать на доски любого города или региона 30$
  • региональная рассылка по определенному региону (доски, каталоги, тематические сайты, e-mail) + тематическая e-mail рассылка 360$.
  • сбор баз любых сайтов, имэйлов miha634@bk.ru

Leave a Reply

Markdown is in effect.



Everything is here.