Forum Moderators: phranque

Message Too Old, No Replies

Apache redirect exclusion

mod_rewite, mod_alias?

         

noshankus

7:46 am on May 9, 2005 (gmt 0)

10+ Year Member



Hi everybody,

I've done a google search, and couldn't find the exact answer to my question on here.

Basically, I want to redirect htdocs/public/old/* to /htdocs/public/new/redirect.php

That I can do myself easily enough, using a PermanentRedirect.

However, I need to keep one sub directory under old at the same URL.
So my question is, how do I exclude a single directory from a redirect.

If I browse to htdocs/public/old/aaa/index.php or htdocs/public/old/index.php etc, I get redirected.

However, if I browse to htdocs/public/old/STAYHERE/index.php - I do not.

I'm assuming that there is some regex I could use here?

Any help is much appreciated!
Best regards,

noshankus

10:15 am on May 9, 2005 (gmt 0)

10+ Year Member



Got it! =)

-> httpd.conf
RewriteEngine On
RewriteCond %{REQUEST_URI}!^/htdocs/public/old/STAYHERE
RewriteRule ^/htdocs/public/old/(.*) /htdocs/public/new/redirect.php [R=301,L]

-> .htaccess
RewriteEngine On
RewriteCond %{REQUEST_URI}!^/htdocs/public/old/STAYHERE
RewriteRule ^/htdocs/public/old/(.*) /htdocs/public/new/redirect.php [R=301,L]

jdMorgan

12:43 pm on May 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



noshankus,

Welcome to WebmasterWorld!

Glad you got it figured out.

Jim