简体   繁体   English

htaccess MIME类型

[英]htaccess mime type

The goal is to create a customized file extension for my *.php test script using .htaccess, I would like to customize a file extension so that when Apache2 "sees" it, then Apache will execute it like a PHP script. 目标是使用.htaccess为我的* .php测试脚本创建自定义文件扩展名,我想自定义文件扩展名,以便当Apache2“看到”它时,Apache将像PHP脚本一样执行它。 Blow is an example 吹就是一个例子

the test URL is: 测试网址为:

localhost/index.xyz

the .htaccess is at directory www and is one line: .htaccess位于目录www且为一行:

AddType application/x-httpd-php5    xyz

the php file, "test.xyz" to run is: 运行的php文件“ test.xyz”是:

<?php
echo "hello, I am a xyz file...";

How could I accomplish this? 我该怎么做?

尝试

AddHandler application/x-httpd-php .xyz

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM