how does the "last" flag work?

Discuss practical ways rearrange URLs using mod_rewrite.

how does the "last" flag work?

Postby Sandra » Tue Jun 08, 2004 8:21 am

I'm writing the rewrite stuff for a wiki and this is what I currently do:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+) /wiki.pl?$1

This works fine - images and other files which actually exist are uneffected while other requests are taken care of by the wiki.

But we also want to store non-wiki-related stuff on the server, so I came up with the idea to have non-wiki URIs prepended by a "nowiki" (while not actually storing it in a nowiki-directory).

I added
RewriteRule ^nowiki/(.+) $1 [L]

but it just strips the nowiki and then sends it to the wiki. Shouldn't the [L]-flag prevent that? What am I doing wrong here?

We have folders named the same as wiki pages, and this is how I want it to be:

http://handgranat.org/sandra <- should take me to the wiki page named sandra
http://handgranat.org/nowiki/sandra <- should be a directory listing (or index.html, if one exists) of the directory named sandra.
Sandra
 

Postby Caterham » Fri Dec 10, 2004 1:42 pm

you've to use

Code: Select all
RewriteRule ^nowiki/ - [L]
above the other rules ('-' means "do nothing"

Bob
Caterham
 
Posts: 690
Joined: Fri Dec 10, 2004 1:30 pm


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 93 guests

cron