-3

Just wanted to know what code I have to put in my .htaccess file so my html pages read php that im going to put in there, (just a contact form), I did find it once but can't remember, sorry and thanks.

  • PHP is a server side language. So you need to install a server and then run php file on that. – ajaykumartak Apr 16 '15 at 13:03
  • I'm not sure I understand, do you mean rewriting URLs in such a way that for example `contact.php` is rewritten to `contact.html`? – Thomas Glaser Apr 16 '15 at 13:03
  • Thank you for the information guys. php is something new to me at the moment, i'm first year web designer learning html5 and css3, php is something I'm looking into at the moment. – Aaron Kelly Apr 16 '15 at 13:19
  • possible duplicate of [Using .htaccess to make all .html pages to run as .php files?](http://stackoverflow.com/questions/4687208/using-htaccess-to-make-all-html-pages-to-run-as-php-files) – Jay Blanchard Apr 16 '15 at 13:20
  • You should get in the habit of [accepting answers](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) that help you to solve your issues. – Jay Blanchard Apr 16 '15 at 13:42

3 Answers3

2

You have to convert your html files to php

put this line in your .htaccess if you're using apache2

AddType application/x-httpd-php .html .htm

but make sure that your .htaccess file is in the root directory of the website

Hemo
  • 49
  • 3
1

If you want PHP in HTML files to be interpreted just add this line to your .htaccess file:

AddType application/x-httpd-php .html .htm
Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119
0

HTML Pages don't read your PHP. Instead Apache is reading your file and executes it with a PHP interpreter if some PHP is in there. Just in case you have a debian server with apache2 you can apt-get install php5. But there is a lot more work to do, for example FCGI and so on.

PKeidel
  • 2,559
  • 1
  • 21
  • 29