【问题标题】:xml error - Attribute name "mod_expires.c" associated with an element type "IfModule" must be followed by the ' = ' characterxml 错误 - 与元素类型“IfModule”关联的属性名称“mod_expires.c”必须后跟“=”字符
【发布时间】:2013-09-05 16:20:31
【问题描述】:

我尝试在xml 模板中使用.htaccess 来利用浏览器缓存。这是代码-

  <IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpg "access 1 year"
  ExpiresByType text/css "access 1 month"
  ExpiresByType text/html "access 1 month"
  ExpiresByType text/x-javascript "access 1 month"
  ExpiresByType image/x-icon "access 1 year"
  ExpiresDefault "access 1 month"
  </IfModule>

xml 给出错误 - 与元素类型“IfModule”关联的属性名称“mod_expires.c”必须后跟“=”字符。我该如何纠正它?

【问题讨论】:

    标签: xml .htaccess


    【解决方案1】:

    你误解了一些没有 xml 标签的东西,即使它看起来像是一个所谓的指令。您不能将其解析为 xml。

    另请参阅有关 if 指令的文档:http://httpd.apache.org/docs/current/mod/core.html#ifmodule

    【讨论】:

    • 那么我应该把 .htaccess 文件放在哪里
    • 只需将该文件放在服务器应该读取的目录中即可。请确保您的服务器配置中有一行“AllowOverride All”
    猜你喜欢
    • 2016-06-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-19
    • 2017-03-12
    • 2012-01-23
    相关资源
    最近更新 更多