通过.htaccess文件为所有PHP脚本设置HTTP头 [英] Set HTTP header for all PHP scripts via .htaccess file
本文介绍了通过.htaccess文件为所有PHP脚本设置HTTP头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
PHP代码:
标题('Content-类型:application / xhtml + xml; charset = utf-8');
标题(Cache-Control:no-transform);
感谢任何帮助。
最好的问候。
Yusuf Akyol
解决方案
你想用.htaccess(或Apache配置)这样做,你可以使用 Apache模块mod_headers ,如下所示:
标题集缓存控制no-transform
标题集Content-Typeapplication / xhtml + xml; charset = utf-8
htaccess set header 为您提供了更多例子。
I code same lines all PHP programs at one of my projects. Is it possible to do this at .htaccess for a directory? And how?
PHP codes:
Header('Content-Type: application/xhtml+xml; charset=utf-8');
Header("Cache-Control: no-transform");
Thanks any help. Best regards.
Yusuf Akyol
解决方案
If you want to do this with .htaccess (or in Apache config), you can use Apache module mod_headers, like this:
Header set Cache-Control "no-transform"
Header set Content-Type "application/xhtml+xml; charset=utf-8"
A search on htaccess set header gives you many more examples of this.
这篇关于通过.htaccess文件为所有PHP脚本设置HTTP头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文