Project

General

Profile

Actions

Bug #937

closed

mod_redirect problem with mod_rewrite

Added by Anonymous over 17 years ago. Updated over 15 years ago.

Status:
Invalid
Priority:
Normal
Category:
mod_redirect
Target version:
-
ASK QUESTIONS IN Forums:

Description

I'm trying to use the following config:
----------------
url.redirect = (
"^/other$" => "/other/"
)

url.rewrite-once = (
"^/other/(.*)" => "/pages/other/$1",
"^/(.+)?$" => "/pages/default/$1"
)
----------------

Expected operation:

1. ://site/other -> redirect to http://site/other/
2. ://site/other/ -> rewrite to /pages/other/
3. ://site/file.jpg -> rewrite to /pages/default/file.jpg

Actual operation:

1. ://site/other -> triggers a 404 error
2. ://site/other/ -> rewrite works
3. ://site/file.jpg -> rewrite works

How can i get the redirect to work?

-- black

Actions #1

Updated by Anonymous over 17 years ago


I'm trying to use the following config:
url.redirect = ( "/other" => "/other/" )

url.rewrite-once = (
"/other/(.*)" => "/pages/other/$1",
"/(.+)?$" => "/pages/default/$1" 
)

Expected operation:

1. ://site/other -> redirect to http://site/other/
2. ://site/other/ -> rewrite to /pages/other/
3. ://site/file.jpg -> rewrite to /pages/default/file.jpg

Actual operation:

1. ://site/other -> triggers a 404 error
2. ://site/other/ -> rewrite works
3. ://site/file.jpg -> rewrite works

Forgot about the wiki formatting thing, just commented for readable report.

-- black

Actions #2

Updated by stbuehler about 16 years ago

  • Status changed from New to Fixed
  • Resolution set to invalid

Do you have mod_redirect before mod_rewrite in your module list?

It is the order of module loading that matters, not the one in the config.

Btw, the bug tracker is not a support forum.

Actions #3

Updated by stbuehler about 16 years ago

Ah, sry: http://trac.lighttpd.net/trac/wiki/Docs%3AModRewrite#with-mod-redirect

So you should use a rewrite "/other$" => "$0" before the others.

Actions #4

Updated by Anonymous about 16 years ago

mod_redirect was set before mod rewrite, yes (still have it so).

Thanks for your reply, i wasn't looking for support, i thought it was an actual bug. Good to remember the $0 for next time. It might be helpful.

As far as my workaround goes, i used "alias.url" afterwards instead of "url.rewrite-once", since i was always rewriting a folder to folder.

-- black

Actions #5

Updated by stbuehler over 15 years ago

  • Status changed from Fixed to Invalid
Actions

Also available in: Atom