0

everybody! I am going to include php code in .html file... I have read the instruction here: include php script inside HTML But after opening my html file on the server, it does not open the html file, instead it downloads the html file. In online server it downloads the file, but in local machine it does not run, but the html file opens.

What is the problem? And how to fix it?

Thank you!

5
  • 1
    You can not save PHP code into .html file if you want to run PHP code than file should be saved with .php extestion. With your reference link please look at askapache.com/htaccess/htaccess.html where AddType Forces file for Save As. Commented Jun 20, 2016 at 9:44
  • 1
    If you want to display your extension as .html instead .php into address bar you can use apache rewrite rules for that purpose. Commented Jun 20, 2016 at 9:46
  • Thank you, @HareshKumar for you reply! I wondered how they could do it in this post: stackoverflow.com/questions/6416418/… )) Displaying php file as .html is also an alternative variant. Could you please tell me how to do that? Commented Jun 20, 2016 at 10:06
  • For URL rewriting you can follow alexcican.com/post/… Commented Jun 20, 2016 at 10:13
  • 1
    Possible duplicate of How do I add PHP code/file to HTML(.html) files? Commented Jun 20, 2016 at 10:25

1 Answer 1

1

This is duplicate questions. Please refer this link. I hope Its will help you.

How do I add PHP code/file to HTML(.html) files?

Thank You!

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.