Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite to redirect specific traffic

         

sparek

6:06 pm on Oct 7, 2004 (gmt 0)

10+ Year Member



I'm looking for a way to redirect some traffic to a different webserver. Basically what I am wanting to do is have a few pages display on the first webserver with all other requests going to the second webserver. For example [domain1.com...] would display this file's contents. There would probably be a few of these file2.html, file3.html, etc. However for most requests, I would like [domain1.com...] to redirect to [subdomain.domain2.com...] . I currently have all traffic for domain1.com going to subdomain.domain2.com accordingly. I am looking for a way to limit and let some pages be called on domain1.com.

Thanks

jdMorgan

7:07 pm on Oct 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



sparek,

Welcome to WebmasterWorld!

Use the RewriteCond %{REQUEST_URI} !^/file2\.html$ construct.

You can use several RewriteConds [httpd.apache.org] to prevent some requests from being redirected, while the RewriteRule redirects all others to your alternate domain.

Se our forum charter [webmasterworld.com] for additional references.

Jim

sparek

8:39 pm on Oct 7, 2004 (gmt 0)

10+ Year Member



Thanks. That was exactly what I was looking for. I'm relatively new to mod_rewrite, I don't use it very often. I figured there was a way this could be done with mod_rewrite just didn't know how. Thanks again.