| Author |
|
dtnsemprog Newbie

Joined: 10 March 2010 Location: United States
Online Status: Offline Posts: 19
|
| Posted: 22 February 2011 at 1:33pm | IP Logged
|
|
|
What I am trying to do is redirect an entire site to another domain using the isapi file. However, there are some directories that I do not want to redirect. The site has hundreds of directories and about 90% of them will redirect to the new domain on another server.
Does anyone know a way that I could write a rule that would redirect the entire site except for a few specified directories?
|
| Back to Top |
|
| |
Guests Guest

Joined: 01 October 2003
Online Status: Online Posts: -149
|
| Posted: 23 February 2011 at 5:43am | IP Logged
|
|
|
Hello,
PLease, see FAQ under "Excluding specific folders from being rewritten"
Regards
Andrew
|
| Back to Top |
|
| |
dtnsemprog Newbie

Joined: 10 March 2010 Location: United States
Online Status: Offline Posts: 19
|
| Posted: 23 February 2011 at 12:45pm | IP Logged
|
|
|
Thanks for the reply Andrew. This is the rule I came up with based on the documentation in the FAQ:
RewriteCond %{SERVER_NAME} ^(?:www\.)?oldsite\.com$ RewriteRule ^(?!(?:folder1|folder2|folder3)/.*).+$ http://www.newdomain.com/ [NC,R=301,L]
And for the most part it seems to work. Folders included in the exception do not get redirected and the other folders do. However, if I just go to "http://www.oldsite.com/" it does not get redirected either. How can I fix this?
Thank you, Jon
|
| Back to Top |
|
| |
Guests Guest

Joined: 01 October 2003
Online Status: Online Posts: -149
|
| Posted: 24 February 2011 at 5:42am | IP Logged
|
|
|
For that, I think you need to replace '+' with '*' here:
RewriteRule ^(?!(?:folder1|folder2|folder3)/.*).*$ http://www.newdomain.com/ [NC,R=301,L]
Regards
Andrew
|
| Back to Top |
|
| |
dtnsemprog Newbie

Joined: 10 March 2010 Location: United States
Online Status: Offline Posts: 19
|
| Posted: 24 February 2011 at 12:17pm | IP Logged
|
|
|
Thanks Andrew! That worked perfectly.
|
| Back to Top |
|
| |
emily Newbie

Joined: 06 April 2011
Online Status: Offline Posts: 1
|
| Posted: 06 April 2011 at 12:27am | IP Logged
|
|
|
I think this statement will work: RewriteCond %{SERVER_NAME} ^(?:www\.)?oldsite\.com$ RewriteRule ^(?!(?:folder1|folder2|folder3)/.*).+$ http://www.newdomain.com/ [NC,R=301,L]
__________________ Essay services | Custom Essay Papers
|
| Back to Top |
|
| |
outshinesol Newbie

Joined: 03 August 2011 Location: India
Online Status: Offline Posts: 1
|
| Posted: 03 August 2011 at 7:36am | IP Logged
|
|
|
RewriteCond %{HTTP_HOST} ^site\com [NC]
RewriteRule (.*) http://www.site.com/$1 [L,R=301]
I thin this wil help you
__________________ Vikas Arora
Dedicated Servers India
|
| Back to Top |
|
| |