Forum Moderators: phranque
I am trying to redirect to link my existing image links to an image server.
such that
http://example.com/1/2/1.jpg will pull images from
[images.example.net...]
This is what I have:
Options +FollowSymlinks
RewriteEngine on
RewriteBase /images
RewriteRule ^/(.*)/(.*)\(.*)\.jpg?$ [images.example.net...] [R=301,L]
This does not seem to work and I do not get any error messages either.
Any suggestions?
[edited by: jdMorgan at 4:16 am (utc) on Sep. 8, 2005]
[edit reason] Examplified. [/edit]
RewriteBase is used when the virtual directory structure of your site doesn't match up to the physical directory structure on the server. Since you are redirecting to another server, this is a moot point, so you don't need it in there.
In an .htaccess file, the / at the beginning is automatically stripped off, so you don't need it. I also made a few changes to make it more efficient. At the end of your Rule, you had "jpg?$"; the question mark would make it match either jp or jpg. Not sure if that's what you had it mind - I took it out, but feel free to add it back in if that's what you wanted.
RewriteRule ^([^/]+)/([^/]+)/([^.]+)\.jpg$ [images.example.net...] [R=301,L]
Chad