1

I have a question. I am fairly new to all of this. I had to switch my website main index from .php to.html. In doing so all of my menu items are not coming up anymore. I believe it has to do with the statement below. My question is how do I change this statement to an html statement that looks up this file so that my meno items come up again.

<?php require("http://www.boonecountysports.com/includes/menu_drop_head.php"); ?>
3
  • Plain HTML can't provide an include like that. What web server do you use (Apache, IIS, for example)? Most web servers have the ability to rewrite incoming requests such that if a user requests index.html, index.php is executed and served. (or do you no longer have PHP available at all?) May 31, 2014 at 2:59
  • You need to modify the .htaccess file as described in this answer: stackoverflow.com/questions/4687208/… May 31, 2014 at 3:00
  • You could use htaccess: Check [here][1] how. [1]: stackoverflow.com/questions/4687208/…
    – Radu Vlad
    May 31, 2014 at 3:00

3 Answers 3

1

Changing to an html extension will render php code useless. Your server will only process php code or specifically <?php require("http://www.boonecountysports.com/includes/menu_drop_head.php"); ?> if the file has an extension of php. To make this work, use the php extension

0

You need to modify the .htaccess file as described in this answer: Using .htaccess to make all .html pages to run as .php files?

Create a .htaccess file at the root of your website and add this line:

[Apache2 @ Ubuntu/Debian: use this directive]

AddType application/x-httpd-php .html .htm If your are running PHP as CGI (probably not the case), you should write instead:

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

0

It depends on the contents of included php file; if the file has html and javascript ONLY you can use that code in the place where the php file included

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.