通过.htaccess文件所有的PHP脚本中设置HTTP头 [英] Set HTTP header for all PHP scripts via .htaccess file

查看:722
本文介绍了通过.htaccess文件所有的PHP脚本中设置HTTP头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我code同样的思路,在我的一个项目的所有PHP程序。是否有可能做到这一点的。htaccess的一个目录?而如何?

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:

PHP codes:

Header('Content-Type: application/xhtml+xml; charset=utf-8');
Header("Cache-Control: no-transform");

感谢任何帮助。 最好的问候。

Thanks any help. Best regards.

优素福阿克约尔

推荐答案

如果你想使用的.htaccess做到这一点(或Apache配置),你可以使用的Apache模块mod_headers中,像这样的:

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"

htaccess的设置头一个搜索为您提供了许多这样的例子。

A search on htaccess set header gives you many more examples of this.

这篇关于通过.htaccess文件所有的PHP脚本中设置HTTP头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆