0

Hey everyone hope all is well! my site www.codebox.co.nz seems to be downloading the index.php instead of displaying the site.

long story short i have build up a website which has a folder in the root directory called "inc" inside this folder I have header.php and footer.php. every time I visit my site http://www.codebox.co.nz/ the index.php downloads and I cannot figure out why :( - inside my .htaccess the file I have this code.

RewriteEngine on

RewriteRule ^(.*)\.html$ $1.php [nc]

AddHandler php5-script .php .html .htm

The site has subfolders with other .php pages in it, all I'm trying to do is use site relative PHP so the header and footer.php are included on all pages regardless of what sub dir. the .php pages the are in!

I'm really lost on this one, I have contacted my hosting provider but they keep telling me to check my PHP code?

I have a feeling it's my .htacccess file.

The code in this file is there so .php outputs as .html as per request of the client.

Any info you could give me would be fantastic.

                <?php 
               $path = $_SERVER['DOCUMENT_ROOT'];
               $path .= "/inc/header.php";
               include_once($path);
            ?>

            <div class="pageTopic">
              <h1>Welcome to Aaron Whiteman Monumental Masonry</h1>
            </div>

            <div id="myCarousel" class="carousel slide carousel-fade" data-ride="carousel" data-interval="5000">
              <!-- Indicators -->
              <ol class="carousel-indicators">
                <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
                <li data-target="#myCarousel" data-slide-to="1"></li>
                <li data-target="#myCarousel" data-slide-to="2"></li>
              </ol>

              <!-- Wrapper for slides -->
              <div class="carousel-inner">
                <div class="item active">
                  <img src="slideshowPics/slideshow1.jpg" alt="Aaron Whiteman Monumental Masonry">
                </div>

                <div class="item">
                  <img src="slideshowPics/slideshow2.jpg" alt="Aaron Whiteman Monumental Masonry">
                </div>

                <div class="item">
                  <img src="slideshowPics/slideshow3.jpg" alt="Aaron Whiteman Monumental Masonry">
                </div>


                <div class="item">
                  <img src="slideshowPics/slideshow4.jpg" alt="Aaron Whiteman Monumental Masonry">
                </div>
              </div>

              <!-- Left and right controls -->
              <a class="left carousel-control" href="#myCarousel" data-slide="prev">
                <span class="glyphicon glyphicon-chevron-left"></span>
                <span class="sr-only">Previous</span>
              </a>
              <a class="right carousel-control" href="#myCarousel" data-slide="next">
                <span class="glyphicon glyphicon-chevron-right"></span>
                <span class="sr-only">Next</span>
              </a>
            </div>

            <section class="light">
              <div class="row">
                <div class="col-lg-12">
                  <p>A memorial set in stone is a lasting way to pay respect to a loved one.</p>
                  <p>Working with families to create permanent memorials is our core business. Since 2003 we have been providing monumental masonry services to the Wellington region, and have gained an excellent reputation for our craftsmanship, innovation and attention to detail.</p>
                  <p>We create both traditional gravestones and innovative new memorials at our Upper Hutt premises. Also, we offer a full restoration and refurbishment service for graves, plaques and headstones. Using traditional techniques combined with the latest technology, we can tailor our services to meet your requirements, creating everlasting memorials that will stand the test of time.</p>
                </div>
              </div>
            </section>

            <?php 
               $path = $_SERVER['DOCUMENT_ROOT'];
               $path .= "/inc/footer.php";
               include_once($path);
            ?>
Yash Karanke
  • 764
  • 1
  • 15
  • 29
andyjhoey
  • 1
  • 2
  • Welcome to Stack Overflow! Questions on professional server or networking-related infrastructure administration are off-topic for Stack Overflow unless they directly involve programming or programming tools. You may be able to get help on [Server Fault](//serverfault.com/). – Blue Jun 25 '17 at 08:45
  • This might be useful - https://stackoverflow.com/questions/29734936/how-to-get-a-php-file-to-run-with-an-html-extension – TimBrownlaw Jun 25 '17 at 08:50
  • 2
    Possible duplicate of [Apache is downloading php files instead of displaying them](https://stackoverflow.com/questions/18422140/apache-is-downloading-php-files-instead-of-displaying-them) – apokryfos Jun 25 '17 at 08:58
  • Your Web server is not executing the php file. Which Web server you are using. – CoderSam Jun 25 '17 at 09:10

0 Answers0