apache - htaccess – FALSE If statement still runs
问题描述
I have an .htaccess file where I am using if statements to turn directives off/on for development and live environments. One used for forcing SSL in live environments works fine but one to control caching runs it's enclosed directives whether true or false.
<If "%{HTTP_HOST} != 'dev-domain.test'">
ExpiresActive On
ExpiresDefault "access plus 0 seconds"
ExpiresByType text/html "access plus 0 seconds"
</If>
I know the if logic works because I added a rewrite inside of it and commented out the other code and it worked when true and didn't redirect when false. I was using...
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 0 seconds"
ExpiresByType text/html "access plus 0 seconds"
</IfModule>
which works but I tried the IF statement out of curiosity and it fails. Why is this?
解决方案
推荐阅读
- c# - 如何检查游戏对象是否有任何类型的组件?
- java - 在 TextView 中保留最近收到的短信
- javascript - 从顶部动画不使用负值?
- c++ - 在 C++ 中生成复合排列的优雅方法
- python - 尽管提供了 conda 路径,但 Mac 上的 Pycharm 错误“没有为项目配置 Python 解释器”
- pythonanywhere - pythonanywhere wsgi模块未找到错误
- android - 如何在 Android 中使用 `MediaElement` 播放声音?
- python-3.x - Django:用户单击按钮后下载 Excel
- php - 如何使用 Aura Dependency Injector (Aura.Di 3.x)?
- android - Android MVVM Dagger 2 - ViewModelFactory 注入