Deny Direct Request to files

Fix it!!

Deny Direct Request to files

Postby webdev9999 » Fri Jul 20, 2007 10:10 am

I want to deny access to direct request for certain type of files like .gif, .jpg, .css and more.

Thrs a file named style.css in my root folder and its path is

This file should not be accessed by anyone(even me) on direct request like through a web browser.

But the file can be accessed by other files in the server like html file or php file..

If my index.html( or anyother file on my server calls for style.css( it must be accessible and not by anythng else.

Hope i was clear in asking my doubt, if not ping here.. :D
Posts: 2
Joined: Thu Apr 12, 2007 4:49 am

Postby richardk » Fri Jul 20, 2007 12:09 pm

You can't do that with mod_rewrite, the only way would be with the Referer header but it is unreliable and can be faked (but if you want to anyway it's hotlinking protection).
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Return to Security with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 1 guest