I'm having some problems on my website using some php code.
My site is mainly using html and php. Instead of repeating lots of lines of script at the top of every page, i'm just using the php include statement:
<?php include('main.php'); ?>
I have a local WAMP server and a mixture of html and php files on my site.
When I run everything locally it all runs perfectly well and the 'include' statement works.
However, when I upload everything to my site, which is hosted on goDaddy, the include statement only works inside .php files. If I use it inside a .html file it fails. It just doesn't include anything.
I have seen some posts which say that this could be resolved by using a .htaccess file. At the moment I don't have one on my site. I did try to upload one into the root directory but the only effect this had was that it displayed a 'Save As' dialog box when I clicked on a page.
I'm guessing that either my syntax is wrong or I've gone down the wrong road to resolve this.
Below is the contents of my .htaccess file. Any ideas as to how I can get the include statement to work inside .html files would be great. Thanks.
#
# Server root folder www .htaccess
# This file provides server security limiting access to the localhost only.
# Comment next four lines to deactivate. (Allows external access)
#
# Order Deny,Allow
# Deny from all
# Allow from 127.0.0.1
# Allow from ::1
AddType application/x-httpd-php .html .php .htm
# To allow execution of cgi scripts in this directory uncomment next two lines.
# AddHandler cgi-script .pl .cgi
# Options +ExecCGI +FollowSymLinks
# Activate this section to use the Private Server Feature!
# Defaults: Username - root; Password - root
# Note AuthUserFile: File path is relative to server root
# To lock server, uncomment the next 4 lines. (A name and password is required)
#AuthName "Uniform Server - Server Access"
#AuthType Basic
#AuthUserFile ../../../htpasswd/www/.htpasswd
#Require valid-user