Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have added

Order Deny,Allow
Deny from all
allow from *my ip*

to my htaccess file but now when I use a function like getimagesize, I get an error while trying to retrieve the data from a local file on the server.

Error: [function.getimagesize]: failed to open stream: Redirection limit reached

When I remove the lines in htaccess it works. I also tried adding "allow from localhost" and "allow from 127.0.0.1" but no avail.

share|improve this question

migrated from stackoverflow.com Mar 7 '11 at 0:47

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers 2

Since it's local, why are you using an HTTP request to fetch the image details? A local path would bypass the webserver and make this a moot question. It would also be far more efficient, since you're not creating/request/receiving/tearingdown an entire HTTP request sequence.

Instead of

 file_get_contents('http://yourserver.com/url/to/image.jpg');

use

 file_get_contents('/file/system/path/to/image.jpg');
share|improve this answer
add comment

Your htaccess seems correct but it doesn't guarantee that Apache is honoring it. Check Apache's error_log for more details on why it's denying access and also if you're allowed to override these settings.

If these files are local, you should probably specify the local path instead of going through HTTP.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.
{"cc_re__cc_re__cc_by_sa_3_0": ["        <li><a href=\"http://area51.stackexchange.com\" title=\"proposing new sites in the Stack Exchange network\">Area 51</a></li>\r\n                        <li><a href=\"http://careers.stackoverflow.com\">Stack Overflow Careers</a></li>\r\n                    \r\n                </ol>\r\n            </td>\r\n    </tr>\r\n</table>\r\n                </div>\r\n            </div>\r\n\r\n            <div id=\"copyright\">\r\n                site design / logo &#169; 2014 stack exchange inc; user contributions licensed under <a href=\"http://creativecommons.org/licenses/by-sa/3.0/\" rel=\"license\">cc by-sa 3.0</a> \r\n                with <a href=\"http://blog.stackoverflow.com/2009/06/attribution-required/\" rel=\"license\">attribution required</a>\r\n            </div>\r\n            <div id=\"svnrev\">\r\n                rev 2014.7.22.1721\r\n            </div>\r\n            \r\n        </div>\r\n    </div>\r\n    <noscript>\r\n        <div id=\"noscript-warning\">Server Fault works best with JavaScript enabled<img src=\"http://pixel.quantserve.com/pixel/p-c1rF4kxgLUzNc.gif\" alt=\"\" class=\"dno\"></div>\r\n    </noscr"], "copyright__copyright__copyright": ["/image.jpg');\nshare|improve this answer\nadd comment\n\nYour htaccess seems correct but it doesn't guarantee that Apache is honoring it. Check Apache's error_log for more details on why it's denying access and also if you're allowed to override these settings.\n\nIf these files are local, you should probably specify the local path instead of going through HTTP.\n\nshare|improve this answer\nadd comment\n\nYour Answer\n\n\u00a0\ndiscard\n\nBy posting your answer, you agree to the privacy policy and terms of service."]}