httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <jos...@slive.ca>
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 .* http://thesite.example.com/ [R]

Joshua.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message