dougou8639 2012-05-03 16:10
浏览 247

PHP文件的自定义MIME类型

Okay, so I have a weird one for you all today. I'm looking into creating a custom MIME type for a .php file. I've read some pro's/con's on this and it won't be for much other than some experimentation to see what can really be done. My company's initials are TTP and so we decided it'd be kinda fun to have all of our .php pages re-written to a custom .ttp extension. I've attempted my normal cPanel X route with adding it in, and I've also tried adding the change into the .htaccess file. It work's perfectly fine until I change the application type to anything php.

AddType text/html ttp  // works
AddType text/x-php ttp // doesn't work
AddType application/x-php ttp // doesn't work
AddType application/x-http-php ttp // doesn't work

Some things that have come up was an issue that doing this renders the .php file and therefore makes it difficult for the browser to decide how to handle it. Any other ideas? I'm pretty sure that at the end of the day this won't be something the company will do, but they wanted to see if any experiment I could run will work.

  • 写回答

2条回答 默认 最新

  • douyan6548 2012-05-03 16:12
    关注

    The browser doesn't handle PHP. Content-Type doesn't matter here.

    Look at your CGI or module configuration, to configure PHP to handle more than .php. For PHP as a module:

    <FilesMatch \.ttp$>
        SetHandler application/x-httpd-php
    </FilesMatch>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭