httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <>
Subject Re: [users@httpd] Redirecting all but one directory
Date Fri, 19 Sep 2003 18:56:18 GMT

On Fri, 19 Sep 2003, josh hough wrote:

> I'm looking for a way to redirect the entire contents of a domain to
> index.html, with the exception of one specific directory, which needs to
> remain accessible.  I don't want to write Redirect directives for every
> single file and directory at the top level of the site.  Is there a good
> way for this with Redirect and regexp, or mod_rewrite perhaps?
> Also, how to avoid an infinite redirect loop when the destination is
> index.html at the top level of the site?
> And, just in case, what if I wanted to exclude more than one directory?
> Thanks in advance.

Something like this (untested):

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/dir1
RewriteCond %{REQUEST_URI} !^/dir2
RewriteCond %{REQUEST_URI} !^/index.html
RewriteCond %{REQUEST_URI} !^/$
RewriteRule .* [R]


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