Forum Moderators: phranque

Message Too Old, No Replies

301 redirect whole site except one folder.

how can i stop one folder from redirecting?

         

ezyid

11:03 am on Sep 7, 2005 (gmt 0)

10+ Year Member



Hello all.
I have yes.. im sorry to say setup a 301 redirect.. im sticking with it but i still use the resources from the old site in a certian folder..
Does anyone know how i can make a specific folder under the domain that has the 301 to not redirect?

here is what im using
"
Redirect 301 / [$site$.com...]
"
It redirects the whole site.. but how can i stop it from redirecting say www.$#*$!$.com/folder/

Thank you.
Steve.

jd01

6:40 pm on Sep 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you are only going to use Redirect, you will need to Redirect each directory separately... If you use mor_rewrite, you can do it in a two rules:

RewriteEngine on
RewriteRule !^the/pathto/the/directory - [C]
RewriteRule (.*) http://www.newsite.com/$1 [R=301,L]

This first rule checks to see if the requested URL is *not* the path to the directory you do not wish to redirect. If this is true (it is not the path) then the [C] (chain) will allow the rewrite to be executed, if it is not true (the path to the directory has been reqeusted) nothing will happen.

Hope this helps.

Justin

jdMorgan

9:02 pm on Sep 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Or alternatively,

RewriteEngine on
RewriteCond $1 !^the/pathto/the/directory
RewriteRule (.*) http://www.newsite.com/$1 [R=301,L]

Jim
[edit] Corrected space deleted by forum. [/edit]

[edited by: jdMorgan at 12:28 pm (utc) on Sep. 8, 2005]

ezyid

8:52 am on Sep 8, 2005 (gmt 0)

10+ Year Member



Sorry mate,
That gives me a 500 internal server error... do i need absolute paths?
i mean to the directory i wash to have "not 301"

Cheers.
Steve.

jdMorgan

12:32 pm on Sep 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry, posting on this forum deletes spaces under certain circumstnaces (in this case between the "}" and the "!" above). I corrected that in the code above. If you still get a 500-Server Error, then try adding:

Options +FollowSymLinks

ahead of that code above.

And if that fails, then please post the relevant error messages from your server error log so we can see what the problem might be.

Jim

EsterA

2:25 pm on Feb 25, 2008 (gmt 0)

10+ Year Member



I want to do the same as above + one more thing: To redirect the url www.old-xyzdomain.zz/ to www.old-xyzdomain.zz/forum/

To clearify:
I want to redirect all urls like www.old-xyzdomain.zz/anything to www.new-xyzdomain.zz/anything respectively, EXCEPT
a) www.old-xyzdomain.zz/forum/ which should not be redirected
and
b) the root url www.old-xyzdomain.zz/ which I want to redirect to www.old-xyzdomain.zz/forum/

How can I do that?

Edited: My original post was a mess.

[edited by: EsterA at 2:47 pm (utc) on Feb. 25, 2008]

EsterA

8:38 am on Feb 28, 2008 (gmt 0)

10+ Year Member



Can it not be done?

g1smd

10:42 pm on Mar 1, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



To be clear, do you need a redirect (where the URL seen in the browser changes) or a rewrite (where the URL shown in the browser does not change)?

EsterA

9:08 pm on Mar 3, 2008 (gmt 0)

10+ Year Member



Redirect, just as I wrote.

g1smd

10:14 pm on Mar 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It is very bad form to redirect the root of a domain, to a deep URL on the same domain.

jdMorgan

12:11 am on Mar 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



True, but these are different domains, so "root" is only relevant to the old domain, which now becomes a subdirectory of the new domain.

For a simple solution, see Apache mod_alias [httpd.apache.org]' Redirect and RedirectMatch directives.

Jim

g1smd

1:06 am on Mar 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



b) the root url www.old-xyzdomain.zz/ which I want to redirect to www.old-xyzdomain.zz/forum/

EsterA

8:06 am on Mar 4, 2008 (gmt 0)

10+ Year Member



Why would it be bad to redirect www.old-xyzdomain.zz/ to to www.old-xyzdomain.zz/forum/ ?

g1smd

12:24 pm on Mar 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The root URL of a domain is the most important URL of the site.

It should directly return content, or 301 redirect to the root of some other, more canonical, domain.