While making your own site, you have numerous alternatives. The fundamental records, especially on Linux servers like the ones utilized for our hosting records, are either for the most part either HTML (documents finishing in the augmentation .html or .htm) or PHP (documents finishing in the expansion .php) records. HTML is the markup dialect for showing content and is not prepared on the server side. Php is a programming style language used to make pages that are handled and served from the server. Php records can simply read and show HTML code, yet HTML does not naturally parse PHP code. To do as such, you should make changes in accordance with your .htaccess record. Once that is done, the PHP code will show inside HTML records without issue. Take after the directions beneath as they guide you on empowering HTML documents to show PHP code by means of your .htaccess record.
Enable HTML files to display PHP code
- Log into your cPanel dashboard.
- Use the File Manager to navigate to the root folder for the domain you are working with, ensuring you set the Show Hidden Files option.
- Once in the root folder for the domain, check .htaccess file. If one is not there, you will need to create a new one. Once located, edit the file by highlighting the file and click on the Edit icon from the toolbar at the top of the page.
- This brings you to the cPanel file editor. You will want to insert the following line of code at the top of the .htaccess file.
- AddType text/html .shtml .shtm .htm .html
- AddHandler server-parsed .shtml .shtm .htm .html
- Options Indexes FollowSymLinks Includes
- # Uncomment the version of PHP you have on your server
- # Only one of the following can be uncommented
- AddHandler application/x-httpd-php5 .shtml
- #AddHandler application/x-httpd-php52 .shtml
- #AddHandler application/x-httpd-php54 .shtml
- #AddHandler application/x-httpd-php4 .shtml
- Tap the Save Changes catch in the upper right corner of the screen. Your html record ought to now show the php code inside it. The following is a previously, then after the fact shot of the impacts of the .htaccess alter.