using htaccess to move stuff offsite


M

Marty Fremen

I want to relocate images to another server to save bandwidth on our main
domain hosting. Rather than altering the html files, I was thinking of just
putting a .htaccess in our /images/ directory:

RewriteEngine on
RewriteRule ^(.+) http://www.example.com/images/$1

I'm assuming this will cause files that would originally have been got from
the images directory to instead be fetched from the external site, but am
wondering if the redirect will itself consume bandwidth. I've not done
htaccess type stuff before, am I right in assuming the amended url goes
back to the browser which then fetches it for itself, and that apache
doesn't actively proxy the requested file?
 
Ad

Advertisements

M

Marty Fremen

Safalra (Stephen Morley) said:
You need to stick an [R=301] on the end (or [R=302] if you only want a
temporary redirect). This will cause the server to send a 301 (or 302)
response to the client with the rewritten address. Proxying is only done
with a [P] on the end.

Thanks, I'll try using [R].
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top