lighttpd forum migration > mod_rewrite help

Posted by Zico (Guest)
on 30.01.2007 15:29
Hi,

I'm new to mod_rewrite and I'm trying to achieve the below, but its 
getting a 404 error.

I have this page

http://mysite.com/player/lyrics.php

I want to make it this

http://mysite.com/lyrics


I've created an .htaccess file in the /player/ directory with the below 
:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^/(.*) /player/$1.php

However when I goto the below I get a 404 error

http://mysite.com/lyrics

Any ideas how to solve this problem?

Thanks
Posted by Christian Hoffmann
on 05.02.2007 20:54
Zico wrote:
> Hi,
> 
> I'm new to mod_rewrite and I'm trying to achieve the below, but its 
> getting a 404 error.
> 
> I have this page
> 
> http://mysite.com/player/lyrics.php
> 
> I want to make it this
> 
> http://mysite.com/lyrics
> 
> 
> I've created an .htaccess file in the /player/ directory with the below 
> :
> 
> Options +FollowSymLinks
> RewriteEngine On
> RewriteRule ^/(.*) /player/$1.php
> 
> However when I goto the below I get a 404 error
> 
> http://mysite.com/lyrics
> 
> Any ideas how to solve this problem?
> 
> Thanks

lighttpd doesn't support per-directory config files and it doesn't 
understand the Apache file format at all.
Use something like url.rewrite = ( "^[^/]+" => "/player/$0.php" ) in 
your lighttpd config file.
Posted by Laszlo Laszlo
on 26.07.2007 04:12
Hi Guys,

I migrated my hosting server from debian+apache2+mod_php to 
gentoo+lighttpd+php-fastcgi. Everything is good, but I've a littel 
apaches .htaccess file:

RewriteEngine On


RewriteRule ^([^,]+)(,([0-9]+))?/$ 
/index.php?gallery=$1&startat=$3&%{QUERY_STRING} [ne]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^((.*)/)?([^/]+\.(jpeg|jpg|jpe|png|gif|bmp|tif|tiff))$ 
/index.php?gallery=$2&image=$3&%{QUERY_STRING} [ne,nc]

RewriteRule ^((.*)/)?feed.xml$ 
/index.php?gallery=$2&template=rss&%{QUERY_STRING} [ne]

Please tell me how to I convert this to lightys url.rewrite.
Thank you!
Posted by Laszlo Laszlo
on 30.07.2007 16:52
Laszlo Laszlo wrote:
> Hi Guys,
> 
> I migrated my hosting server from debian+apache2+mod_php to 
> gentoo+lighttpd+php-fastcgi. Everything is good, but I've a littel 
> apaches .htaccess file:
> 
> RewriteEngine On
> 
> 
> RewriteRule ^([^,]+)(,([0-9]+))?/$ 
> /index.php?gallery=$1&startat=$3&%{QUERY_STRING} [ne]
> 
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteCond %{REQUEST_FILENAME} !-f
> 
> RewriteRule ^((.*)/)?([^/]+\.(jpeg|jpg|jpe|png|gif|bmp|tif|tiff))$ 
> /index.php?gallery=$2&image=$3&%{QUERY_STRING} [ne,nc]
> 
> RewriteRule ^((.*)/)?feed.xml$ 
> /index.php?gallery=$2&template=rss&%{QUERY_STRING} [ne]
> 
> Please tell me how to I convert this to lightys url.rewrite.
> Thank you!

My lighttpd.conf file:
    url.rewrite-once = (
        "^/([0-9]+)-([0-9]+)/([^\/]+)(\?|\ )?(.*)$" =>
"/galeria/index.php?gallery=$1&startat=$3",
        "/(.*).(.*)" => "$0",
        "/(data|docs|galleries|includes|locale|templates|tools)/" =>
"$0",
        "^/([^.?]*).(/|\.jpg|\.gif|\.png|/[^.]*)$" =>
"/galeria/index.php?gallery=$2&image=$3",
    )
See my gallery: http://laszlo.co.hu/galeria/
The main page of the gallery is good, but when I click a sub-gallery
I've got 404 Error.