dqlk31541 2013-12-15 23:08
浏览 57
已采纳

在特定目录中的特定html页面上启用PHP

I have a Rackspace Cloud Sites account and I'm trying to enable PHP for a single html file in a specific directory under my root site folder.

I have a .htaccess file in my root folder. And my document root from using $_SERVER['DOCUMENT_ROOT'] is /mnt/stor1-wc2-dfw1/myaccnum/servernum/mydomain.com/web/content(I've obscured a few details but the basic structure is intact).

I then do the following (which I saw on another SO answer):

<Directory "/mnt/stor1-wc2-dfw1/myaccnum/servernum/mydomain.com/web/content/mydir">
  <Files "index.html">
    AddType application/x-httpd-php .html .htm
  </Files>
</Directory>

However, I'm getting error "500 Internal Server Error". If I take away <Directory> and <Files> everything works but for all files.

How can I fix this?!

  • 写回答

1条回答 默认 最新

  • dongyigua4468 2013-12-15 23:20
    关注

    You cannot add types per directory or location. However, you can manipulate the engine ini setting of PHP. Set it to off globally and enable it only for your index.html.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 R语言卸载之后无法重装,显示电脑存在下载某些较大二进制文件行为,怎么办
  • ¥15 java 的protected权限 ,问题在注释里