You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Gary Smith <Ga...@primeexalia.com> on 2009/04/06 20:32:00 UTC

[users@httpd] rewrite question

We have a web site that is being pounded pretty hard.  The web site has lots of graphics and our bandwidth is being killed.  We have a dedicated server at another location where we get more bandwidth cheaper (but the overall processing sucks so it can't push the full site).

We would like to rewrite all gif/png/jpegs for www.domain.com and domain.com to go to images.domain.com.  Basically we have rsynced the content to the second domain and until we can tweak the thousands of HTML pages we want to just redirect.

Anyway have a working rule handy for doing this.  I know we will still take a bandwidth hit but like I said, this is just a work around for now.

Thanks.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] rewrite question

Posted by Brian Mearns <me...@gmail.com>.
On Mon, Apr 6, 2009 at 3:28 PM, Gary Smith <Ga...@primeexalia.com> wrote:
> Rich,
>
> The rewrite below is exactly what I want to do.  Thanks.
>
>
>
> From: Rich Bowen [rbowen@rcbowen.com]
> Sent: Monday, April 06, 2009 12:09 PM
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] rewrite question
>
>
>
>
> On Apr 6, 2009, at 14:32, Gary Smith wrote:
>
>
> We have a web site that is being pounded pretty hard.  The web site has lots of graphics and our bandwidth is being killed.  We have a dedicated server at another location where we get more bandwidth cheaper (but the overall processing sucks so it can't push the full site).
>
> We would like to rewrite all gif/png/jpegs for www.domain.com and domain.com to go to images.domain.com.  Basically we have rsynced the content to the second domain and until we can tweak the thousands of HTML pages we want to just redirect.
>
> Anyway have a working rule handy for doing this.  I know we will still take a bandwidth hit but like I said, this is just a work around for now.
>
>
>
>
> Assuming you have sensible URIs, you can:
>
>
> ProxyPass /images http://images.domain.com/images
>
>
> If not, then you can:
>
>
> RewriteEngine On
> RewriteRule (.*\.(jpg|png|gif))$ http://images.domain.com$1 [R,NC]
>

Proxy won't help you...in fact it will kill your bandwidth even worse
because you're still serving up all the same content, plus you have to
fetch it from the other server. The rewrite rules the [R] flag is the
correct approach. Also, consider using a permanent redirect like
[R=301] if it will in fact be a permanent set up.

-- 
Feel free to contact me using PGP Encryption:
Key Id: 0x3AA70848
Available from: http://pgp.mit.edu/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] rewrite question

Posted by Gary Smith <Ga...@primeexalia.com>.
Rich, 

The rewrite below is exactly what I want to do.  Thanks.



From: Rich Bowen [rbowen@rcbowen.com]
Sent: Monday, April 06, 2009 12:09 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] rewrite question




On Apr 6, 2009, at 14:32, Gary Smith wrote:


We have a web site that is being pounded pretty hard.  The web site has lots of graphics and our bandwidth is being killed.  We have a dedicated server at another location where we get more bandwidth cheaper (but the overall processing sucks so it can't push the full site).

We would like to rewrite all gif/png/jpegs for www.domain.com and domain.com to go to images.domain.com.  Basically we have rsynced the content to the second domain and until we can tweak the thousands of HTML pages we want to just redirect.

Anyway have a working rule handy for doing this.  I know we will still take a bandwidth hit but like I said, this is just a work around for now.




Assuming you have sensible URIs, you can:


ProxyPass /images http://images.domain.com/images


If not, then you can:


RewriteEngine On
RewriteRule (.*\.(jpg|png|gif))$ http://images.domain.com$1 [R,NC]






--
A stupid man's report of what a clever man says can never be accurate, because he unconsciously translates what he hears into something he can understand.
    Bertrand Russell
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] rewrite question

Posted by Rich Bowen <rb...@rcbowen.com>.
On Apr 6, 2009, at 14:32, Gary Smith wrote:

> We have a web site that is being pounded pretty hard.  The web site  
> has lots of graphics and our bandwidth is being killed.  We have a  
> dedicated server at another location where we get more bandwidth  
> cheaper (but the overall processing sucks so it can't push the full  
> site).
>
> We would like to rewrite all gif/png/jpegs for www.domain.com and  
> domain.com to go to images.domain.com.  Basically we have rsynced  
> the content to the second domain and until we can tweak the  
> thousands of HTML pages we want to just redirect.
>
> Anyway have a working rule handy for doing this.  I know we will  
> still take a bandwidth hit but like I said, this is just a work  
> around for now.
>

Assuming you have sensible URIs, you can:

ProxyPass /images http://images.domain.com/images

If not, then you can:

RewriteEngine On
RewriteRule (.*\.(jpg|png|gif))$ http://images.domain.com$1 [R,NC]



--
A stupid man's report of what a clever man says can never be accurate,  
because he unconsciously translates what he hears into something he  
can understand.
     Bertrand Russell