Redirect all traffic except one specific directory?
am 23.06.2007 22:38:01 von Burma JonesThis is a multi-part message in MIME format.
------=_NextPart_000_0008_01C7B59B.B7FD5620
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I want to redirect *all* traffic to http://mysite.com to =
http://destination.com, except for one specific directory.
Here is my .htaccess file:
RewriteEngine on
RewriteCond $1 !^SomeDirectory
RewriteRule (.*) http://destination.com/$1 [L]
So if I type in http://mysite.com/SomeDirectory it works fine, taking me =
to that directory. And if I type in http://mysite.com it takes me to =
http://destination.com.
But if I type in *anything* else, whether it is an actual directory or =
file, or whether it is a typo, it takes me to an error page on the =
destination site. For example, http://mysite.com/TypoError takes me to =
http://destination.com/TypoError with a "404 File Not Found Error".
Is there a way to have it so *anything* other than =
http://mysite.com/SomeDirectory will get redirected to =
http://destination.com?
------=_NextPart_000_0008_01C7B59B.B7FD5620
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
charset=3Diso-8859-1">
traffic to href=3D"http://mysite.com">http://mysite.com to href=3D"http://destination.com">http://destination.com, except for =
one=20
specific directory.
file:
RewriteCond =
$1=20
!^SomeDirectory
RewriteRule (.*) href=3D"http://destination.com/$1">http://destination.com/$1 =
[L]
/A> it=20
works fine, taking me to that directory. And if I type in href=3D"http://mysite.com">http://mysite.com it takes me to href=3D"http://destination.com">http://destination.com.
else, whether=20
it is an actual directory or file, or whether it is a typo, it takes me =
to an=20
error page on the destination site. For example, href=3D"http://mysite.com/TypoError">http://mysite.com/TypoE rror =
;takes me=20
to href=3D"http://destination.com/TypoError">http://destination .com/TypoErro=
r=20
with a "404 File Not Found Error".
*anything*=20
other than href=3D"http://mysite.com/SomeDirectory">http://mysite.com/S omeDirectory<=
/A> will=20
get redirected to href=3D"http://destination.com">http://destination.com?
/FONT>
------=_NextPart_000_0008_01C7B59B.B7FD5620--