* Mark Stosberg <[EMAIL PROTECTED]> [2005-11-22 20:24:39+0000]
> On 2005-11-22, Dan Horne <[EMAIL PROTECTED]> wrote:
>     RewriteEngine On
>     RewriteBase /
>     # Rewrite current-style URLs of the form 'index.php?q=x'.
>     RewriteCond %{REQUEST_FILENAME} !-f
>     RewriteCond %{REQUEST_FILENAME} !-d
>     RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]
> 
> Since mod_rewrite is actually voodoo, I can't tell you exactly what that does,
> but I can tell it passes everything through an index.php script. 

mod_rewrite isn't all that voodoo'ish. The above example is rather
easy to follow. 

It checks whether the requested filename is actually an existing
file or directory on the filesystem. If not, than it'll pass
everything on to index.php (Query String Appended (QSA)). That
should be the Last rule too ([L, QSA]). 
The checks prevents Apache from shifting GETs for images, css files
etc. to index.pl All is rather well documented at Apache's
website[1].

I do dislike this way though. It's totally unclear what the
index.php actually does with the input. It's be easier to write
something like:

RewriteRule ^([^/]+)/([^/]+)$   /index.php?rm=$1;subcat=$2

Etc. etc. I find that easier to read/debug than one big "q"
variable.

  1. http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html
-- 
B10m

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to