Project

General

Profile

URL rewriting not working

Added by Wintermute over 14 years ago

Hi,

I have the following configuration :

url.rewrite-once = (".*\.(js|gif|jpg|png|css)$" => "$0", "^/$" => "/index.php")

The URL rewriting is not working. I get a 404 error

Could someone help me ?

The lighttpd.conf is the second one (8,12 ko)


Replies (8)

RE: URL rewriting not working - Added by Wintermute over 14 years ago

Lighttpd is not a good choice : bad documentation and no support. I'm going to use another server...

RE: URL rewriting not working - Added by icy over 14 years ago

You did not state which URL is giving a 404, it's impossible to answer your question.

RE: URL rewriting not working - Added by Wintermute over 14 years ago

I don't understand your answer.

With Apache I use the following configuration (.htaccess):

RewriteEngine on

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

RewriteRule ^(.*)$ index.php [L,QSA]

I want to do the same with Lighttpd. All URLs should be replaced by ./index.php.
The URL is http://localhost/~jerome/blog/montest/3

access.log contains :

127.0.0.1 localhost - [13/Nov/2010:11:48:48 +0100] "GET /~jerome/blog/ HTTP/1.1" 200 754 "-" "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101030 Gentoo Firefox/3.6.12" 
127.0.0.1 localhost - [13/Nov/2010:11:48:51 +0100] "GET /~jerome/blog/montest/3 HTTP/1.1" 404 345 "-" "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101030 Gentoo Firefox/3.6.12" 

Maybe does Lighttpd not really support that ?

RE: URL rewriting not working - Added by icy over 14 years ago

Or maybe it does and your rewrite rule from post 1 is totally different?
"^/$" ONLY matches "/", NOTHING ELSE.

Try

url.rewrite-if-not-file ("^/[^?]*(\?.*)?$" => "/index.php$1")

RE: URL rewriting not working - Added by Wintermute over 14 years ago

1) The = is missing :

url.rewrite-if-not-file *=* ("^/[^?]*(\?.*)?$" => "/index.php$1")

2) It does not work. I still get a 404 error.

RE: URL rewriting not working - Added by Wintermute over 14 years ago

It only works when I do not use mod_userdir.

I created a symlink :
/var/www/localhost/htdocs/blog/ -> /home/jerome/public_html/blog/

The I use the URL :
http://localhost/blog/montest/3

But I would like to use URL rewriting with userdir.

RE: URL rewriting not working - Added by Wintermute over 14 years ago

I'm sorry but I'm not going to use Lighttpd anymore : lack of documentation and no support.

RE: URL rewriting not working - Added by solobot over 14 years ago

Dont forget no escape special symbols

    (1-8/8)