How to configure add on domain

  • Answered
I recently added a domain using the add on domain feature in cPanel. The add on domain comes up on my browser but the php code is not appearing which makes me think I need to configure some settings or a file for this domain.

The first domain was configured using Word Press and that site is working so I know the server works. The second domain appears in the browser but the php code does not appear. For testing purposes I used a simple php code from W3schools php tutorial and tested it with WAMP server on my local machine but after uploading the file the code no longer works which leads me to believe it is a configuration problem.

This is the php code I used to test with. I omitted the open and close php tags to show this is simple code.

echo "My first PHP script!";

Hello evilbadger, I have taken a look at your page and have discovered the issue. The page you are working with is an html page. By default, php will not run from an html page, but a php page will do both php and html without modification. To fix the issue, you need a hidden configuration file in the root folder of your domain named .htaccess. Inside that folder, you needed the following line of code to allow html to run the php.
AddType application/x-httpd-php5 .html
I went ahead and created that file and added the line of code in the root folder of the add-on domain. You can now see the php script within the html file. You are now all set to create your site. If you have any further questions, please do not hesitate to contact us again. Good Luck on your site! Best Regards, Scott M