I'm trying to tighten up security here. Right now access to my folders can be seen by anyone. What I would like to do is redirect any traffic that tries to hit these pages to my homepage jvfconsulting.com this is the url to the folder I would like to restrict access to. http://www.jvfconsulting.com/amass/images/ This code worked and it would redirect you to the url if you clicked on the picture, but all the pics on the website would not work. RewriteEngine on RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://www.jvfconsulting.com [R,NC] This one would work only if you were in one directory… redirect 301 /amass http://www.jvfconsulting.com/
Hello all! Yes, but the above code does not stop people from LINKING to your images! (Like from another website. It does stop people from getting a DIRECTORY of your images.) However, the following code DOES block all external references, but not references from the website: RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://www\.yoursitenamehere\.com/.*$ [NC] RewriteRule \.(gif|jpg|png)$ - [F] It returns an HTTP FAIL code. There is a way to do what jvfconsulting asked about (send any invalid reference to the home page), but that is a bit more involved. Enjoy!
The following should work RewriteRule ^/amass/(.*)$ http://www.jvfconsulting.com [R] Code (markup): Or even better place the following in .htaccess file in amass directory RewriteEngine On RewriteRule ^.*$ http://www.jvfconsulting.com [R] Code (markup):
Thanks Nasty.Web & chrissyj! I ended up using a code that just blocks access to all the files. I'm going to give the code jmf000 just posted about and see if that works for me. Here is the code that i'm using in the mean time. Is this incorrect and if so why? The .htacess file was placed in my public_html folder with only 1 line of code and this was it... Options -Indexes