KBD

Keith Devens .com

Saturday, November 22, 2008 Flag waving
Premature abstraction is an equally grevious sin as premature optimization. – me
← Boosting Trees applied to spam filtering?Design of my CMS, or Template problem →

Daily link icon Wednesday, November 12, 2003

Send all requests to a single script with mod_rewrite

This is what I have in my Apache .htaccess file that sends all requests to my CMS. It checks first if the request is for an actual file or directory, and if it's not it forwards everything to "dispatcher.php"

RewriteEngine On

#if the request isn't for a file or a directory...
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . dispatcher.php
← Boosting Trees applied to spam filtering?Design of my CMS, or Template problem →

Comments XML gif

August Trometer (http://blog.foggynoggin.com) wrote:

Egads! What a perfect set of rewrite rules! With a little modification, this is exactly what I need for a project I'm working on. Thanks!

∴ August Trometer | 12-Nov-2003 4:50pm est | http://blog.foggynoggin.com | #3248

cagrET (http://g0su.net) wrote:

I have very similiar rule in my cms

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

There is only one problem with that.
I installed some scripts few weeks ago and authorization in admin panel was made with .htaccess & .htpasswd - and it didnt work Smiley frowning because of the rewrite conditions above ... looks like apache didnt recognize admin/ directory in those scripts as directory, huh ;/

http://example.com/ - main page, .htaccess with rewrite rules here
http://example.com/script/admin/ - admin panel in 3rd party scripts

∴ cagrET | 15-Nov-2003 7:26pm est | http://g0su.net | #3277

Feel free to post a comment below. Please see my comment policy.

Formatting Rules (No HTML):

  • **bold**, *italic*, _underlined_, --strikeout--
  • "text"="url" creates a link, and URLs are auto-highlighted
  • Blockquote: Like e-mail, begin paragraph with > (greater-than sign)
  • Lists: begin paragraph with *,-, or + (unordered), or # (ordered)
  • Code block: ?!code:language=perl|php|sql|javascript|etc.{\n}...{\n}?!/code

:
(will be your IP address if blank)
: (optional)
(Will not be shown on site)

: (optional)
:

November 2008
SunMonTueWedThuFriSat
 1
2345678
9101112131415
16171819202122
23242526272829
30 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 4 posts

Recent comments XML

Calif. Supreme Court to take up gay marriage ban

I would argue the point is not​definitional.  While the word​marriage is su...

Justin: Nov 20, 4:37pm

Java join function

Meh, don't have null strings in​your string arrays imo, but you're​welcome ...

Keith: Nov 19, 7:51pm

Girls, please don't get breast implants

sorry but another thing i have to​make a comment on about you​men...the men...

happynow: Nov 17, 11:36pm

Books by Vincent Cheung

to all Cheung​fans:

read:

http://www.progin​osko.com/aquascum/cheung.h...

Zamir: Nov 16, 9:07am

Generated in about 0.207s.

(Used 8 db queries)

mobile phone