简体   繁体   中英

how to configure server to look in to .xphp extention files for php code

In my project I want to store all new/specific code into files with xphp extension but I want server to parse those file as .php. Can we configure this. If yes how?

I am using Apache server with php 5.6.3, with access to server configurations.

Thanks in Advance.

in apache2 you can add multiple handlers as follows:

within your .conf file which is often located in /etc/apache/sites-available/ in linux/ubuntu , add this line

AddType: application/xhttpd-php .xphp

this will only take effect on the virtual host which you are adding this line to,

if you want your changes take effect on all your hosts, add this line to your /etc/apache2/apache2.conf

if you don't have an access to you server configurations files :

you can add this line to your .htaccess file :

Addhandler application/x-httpd-php .html .php .xphp

don't forget to restart your apache2 after changing the conf files

sudo service apache2 restart

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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