httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin French <>
Subject Re: [users@httpd] mod_rewrite or Multiviews or custom 404???
Date Fri, 09 Jan 2004 00:48:20 GMT
Following up to my own post, for archive's sake...

On Thursday, January 8, 2004, at 02:03  PM, Justin French wrote:

> I'd like an generic solution to the following problem:
> if a url exists (eg /dir/dir/file.html)
> 	-> apache serves the url as per normal
> else
> 	-> the request is passed to /index.php (but the url remains as 
> entered in the browser)
> I'm intending to use /index.php as a fusebox-style front controller 
> script, but don't want to loose the ability to manually add 
> directories and files that *don't* use the fusebox.

!-f and !-d modifiers (among others) can check if the file or directory 
can be found/accessed, which is exactly what i needed :)

<IfModule mod_rewrite.c>
	RewriteEngine On
	# if is not a file
		RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-f
	# OR not a directory
		RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-d
	# rewrite
		RewriteRule (.*) /path/to/index.php?request=$1


Which I can then parse with PHP for my fusebox-style app.

Justin French

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message