mod_rewrite question

This is a discussion on mod_rewrite question within the Apache Web Server forums, part of the Web Server and Related Forums category; Hi I've recently got mod_rewrite compiled and configured for Apache on my webserver machine. It's working fine, i ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-06-2004
bengee
 
Posts: n/a
Default mod_rewrite question

Hi

I've recently got mod_rewrite compiled and configured for Apache on my
webserver machine. It's working fine, i know how to configure it, and so on.

I'm hosting my own website from home, but have placed images onto my
ISP's webspace and configured mod_rewrite to "rewrite" any URL's that
are in the image dir (/img) to look on my ISP's webspace.

Now, when people browse my site will _their_ browser grab the images
from my ISP, or will _my_ webserver grab the images and send to the web
broswer?

The reason i setup mod_rewrite is to save my bandwidth, i.e. images are
downloaded from my ISP. Does this make sense? Is this one of the things
that mod_rewrite can do? If not can anyone recommend what i can do?

TIA

Ben
  #2 (permalink)  
Old 04-06-2004
Joachim Ring
 
Posts: n/a
Default Re: mod_rewrite question

> Now, when people browse my site will _their_ browser grab the images
> from my ISP, or will _my_ webserver grab the images and send to the web
> broswer?


both is posible.

> The reason i setup mod_rewrite is to save my bandwidth, i.e. images are
> downloaded from my ISP. Does this make sense? Is this one of the things
> that mod_rewrite can do? If not can anyone recommend what i can do?


if you used the [R] flag for RewriteRule, or none at all, since it is
an external absolute uri, the users browser will get a redirect and
fetch the image from the given location.

if you use [P] which is only available when mod_proxy is loaded,
apache will work as a reverse proxy and fetch the image itself before
delivering it to the user - double bandwidth penalty...

joachim
  #3 (permalink)  
Old 04-06-2004
bengee
 
Posts: n/a
Default Re: mod_rewrite question

Joachim Ring wrote:
>>The reason i setup mod_rewrite is to save my bandwidth, i.e. images are
>>downloaded from my ISP. Does this make sense? Is this one of the things
>>that mod_rewrite can do? If not can anyone recommend what i can do?

>
>
> if you used the [R] flag for RewriteRule, or none at all, since it is
> an external absolute uri, the users browser will get a redirect and
> fetch the image from the given location.


Here's the rule i used (yes it's without [R]) :-

RewriteRule ^/img/(.*)$ http://www.benzalez.plus.com/2halfsimg/$1

When i load the page in my browser i can see the status bar quickly
flash "connecting to www.benzalez.plus.com", but when i do a view source
images still show as "img/whatever.gif".

I take it when the broswer asks for "img/whatever.gif", apache then
sends back a redirect to the www.benzalez.plus.com site?

Ben
  #4 (permalink)  
Old 04-06-2004
Richard Antony Burton
 
Posts: n/a
Default Re: mod_rewrite question


"bengee" <postmaster@localhost.localdomain> wrote in message
news:O8Gcc.30620$Y%6.3769409@wards.force9.net...

> I take it when the broswer asks for "img/whatever.gif", apache then
> sends back a redirect to the www.benzalez.plus.com site?


Easy way to tell is to look at the image properties in the browser, if it says
the image is located on the ISP site then you have what you want, if it claims
to be from your own server then you know it wasn't redirected (so probably
proxied).

Richard.


  #5 (permalink)  
Old 04-07-2004
HansH
 
Posts: n/a
Default Re: mod_rewrite question

"Richard Antony Burton" <richardaburton-NOSPAM-@hotmail.com> schreef in
bericht news:NcGcc.12583464$Of.2094463@news.easynews.com.. .
> "bengee" <postmaster@localhost.localdomain> wrote in message
> news:O8Gcc.30620$Y%6.3769409@wards.force9.net...
> > I take it when the broswer asks for "img/whatever.gif", apache then
> > sends back a redirect to the www.benzalez.plus.com site?

> Easy way to tell is to look at the image properties in the browser, if it

says
> the image is located on the ISP site then you have what you want, if it

claims
> to be from your own server then you know it wasn't redirected (so probably
> proxied).

After changing some settings and restarting Apache don't forget to flush
your browsers cache...its data may prevent the browser from requesting the
image from your server and you will not see a change in the properties of
the image either.

HansH


  #6 (permalink)  
Old 04-07-2004
bengee
 
Posts: n/a
Default Re: mod_rewrite question

Richard Antony Burton wrote:
>>I take it when the broswer asks for "img/whatever.gif", apache then
>>sends back a redirect to the www.benzalez.plus.com site?

>
> Easy way to tell is to look at the image properties in the browser, if it says
> the image is located on the ISP site then you have what you want, if it claims
> to be from your own server then you know it wasn't redirected (so probably
> proxied).


I looked at the image properties in my browser (Mozilla) and it says
that the images come from my own server (2halfs.com). However, i tricked
my webserver into thinking that www.benzalez.plus.com was somewhere else
(edit /etc/hosts), and voila... the graphics still loaded in the
browser. I then tricked my windows/web browser machine into thinking
www.benzalez.plus.com was somewhere else (edit hosts files)... guess
what? graphics couldn't be loaded.

This confirms to me that it's the web browser that is trying to grab the
images of www.benzalez.plus.com, and NOT my webserver :-)

Thanks all

Ben
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:06 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0