0

I need to do a 301 directory redirect in my httpd.conf file but exclude a subdirectory within the directory. Example:

RedirectPermanent /redirect/  http://www.mysite.com/

But I want to exclude this subdirectory /redirect/example/

Any ideas?

regilero
  • 29,806
  • 6
  • 60
  • 99
  • That won’t work with the Redirect directive, you’ll have to do the redirecting using mod_rewrite instead. – CBroe Sep 10 '13 at 11:51
  • see also http://stackoverflow.com/questions/9814100/redirect-all-but-one-file-in-a-directory-via-httpd-conf-htaccess to avoid mod_rewrite and use `RedirectMatch` – regilero Sep 10 '13 at 14:35
  • After working on this on and off for a couple of days, I finally came up with a combination that works: – user2270874 Sep 18 '13 at 12:04
  • RewriteEngine on RewriteCond %{REQUEST_URI} !^/redirect/example/.*? [NC] RewriteRule ^/redirect/? http://www.mysite.com [R=301,L] – user2270874 Sep 18 '13 at 12:05

0 Answers0