douzi115522 2014-04-03 06:00
浏览 66

我想通过Url获取.htaccess文件内容

I am using this function to get content of .htaccess file

file_get_contents('http://www.example.com/.htaccess')

But its give me this error

failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found 

But When i open this url its working fine

file_get_contents('http://www.example.com/robots.txt')

Please help me to solved this Problem.

Thanks

  • 写回答

3条回答 默认 最新

  • douchuang4402 2014-04-03 06:03
    关注

    The default configuration for any HTTP server that supports .htaccess configuration files is to not expose them over HTTP.

    At best, the details of the server's configuration are not something the public needs to know about and, at worst, could be a serious security problem if exposed to the public.

    You could look in to reconfiguring the server to make the .htaccess files public, but you would be better served accessing the file using the file system instead of HTTP.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化