Forum Moderators: phranque

Message Too Old, No Replies

Is this rewrite correct? Diagnosing error, mine vs server/host.

         

JS_Harris

10:03 pm on Aug 5, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



As the title suggests I've added a mod_rewrite rule to convert affiliate images into local images.

I want something like
ht*p://i.example.com/13/!B(z-(QgBGk~$(KGrHgoOKkUEjlLmVks,BKeMj2GlYw~~_1.JPG

to become
ht*p://www.example.com/f/!B(z-(QgBGk~$(KGrHgoOKkUEjlLmVks,BKeMj2GlYw~~_1.JPG

and i've written
RewriteRule ^/images/f/(.*)$ ht*p://i.example.com/$1 [R,L]

The /13/ is random on the from uri so i'm not carrying it over and the "examples" are NOT the same site. For whatever reason my rule isn't working but the site host has a history of taking a few hours to update any changes to .htaccess. That being the case is the mistake mine or should I make a change, or is the rule good to go?

Thanks in advance

g1smd

10:27 pm on Aug 5, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You say "convert", but what you have there is a 302 redirect.

That's likely not the right thing to do.

JS_Harris

11:20 pm on Aug 5, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



302 is 'moved temporarily' which I didn't give a second thought about, thanks for mentioning it. The images will only be on my site for a few days so R=301 is indeed the way to go.

g1smd

12:15 am on Aug 6, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



*** mod_rewrite rule to convert affiliate images into local images ***

With a redirect, they are still 'remote'.

What's the purpose of whatever it is you are trying to do?

jdMorgan

12:47 am on Aug 6, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A couple of points:

1) You've got ^/images in your pattern, yet the example URLs don't have "/images" in them.

2) The RewriteRule pattern will change depending on where the code is located -- in .htaccess, in httpd.conf, or within httpd.conf *and* inside a <Directory> section. In the first and last cases, the pattern should not start with a slash, because the slash won't be present in the variable examined by RewriteRule.

Oh, and which "example" is local and which is remote? Feel free to use "remote.com" and "local.com" in your posts if you like, and I can de-link them if you don't do it yourself.

Jim