tags:

views:

47

answers:

2

Hi all,

I want to move some files to another directory on my web server, but these files are images, that my clients link to. I have not got the time to go and change over 100 image urls, so is there a way i can get .htaccess file to do a mod_rewrite to point then image url to where it should be?

Thanks

Fero

+1  A: 

You can limit this on the server side.

One way it to check the referer header if it matches with your site.

The other is to use a special loading mechanism between the server and flash that passes some sort of token or HTTP authentication, and maybe protect the token/auth with SSL.

Whatever you choose it will not be 100% bullet proof and IMO is not worth the hustle.

Emil Ivanov
Note that the referer header is optional and some personal security software modifies it. You can't depend on it.
David Dorward
Dravid - I agree.
Emil Ivanov
A: 

Yes, that's rather the point of mod_rewrite.

If you are just moving a directory wholesale, then a simple redirect will be easier though.

Redirect 301 /old/images/ http://example.com/new/images/
David Dorward
David.. I am not moving the directory wholesale. I need just if any one type the path in the address bar then "FORBIDDEN" page should be redirected. Awaiting for the answer. thanks in advance
Fero
That doesn't appear to have anything to do with the question you asked.
David Dorward
Hang on. When you say "FORBIDDEN" do you mean "NOT FOUND"? I don't think you can trap that in mod_rewrite. You could set up a mod_perl handler, PHP script or similar as your ErrorHandler document though.
David Dorward
http://www.splocs.com/images/ Please use the above URL. This is exactly what i need...
Fero
You want to disable the directory index? That's one of the settings of the Options property in the Apache configuration.
David Dorward
But i did using .htaccess. But in the mean time if i enter the name of the image following by the path the image is displaying. This should not happen. Any better way to do.
Fero
In simple images in my project should be protected.
Fero
Might as well just delete them from the server then. You can't let people use images in a webpage but not let them view the images outside the page.
David Dorward