Hi. This is not a frequently browsed category, but there is no place else for my question.

I am organizing my site to make it easier and faster to maintain. I keep a small version of my site on my laptop running Apache/PHP. I successfully organized and recoded things to the way I wanted. The root has only the homepage (index.html). I have the style.css file, image files, and header and footer files in a folder called Style. I have pages such as 'About Us' and 'Contact Us' in a folder called Fold_1.

In my aboutus.php file, I access the header and footer files using

<?php> include ('../style/header.php') ?>

In the header.php file, I access the style sheet and images using

< (...) href = "../style/style.css">

In the style.css file, I access the background image using

{background-image:url('bgimage.gif');}

This works perfectly in Apache/PHP on my laptop.


When I uploaded files coded this way to my live site, NOTHING WORKED. The pages like aboutus.php had no CSS formatting, and no code from the header or footer. It was as if the file was not locating any of the styling files. I was able to have the file find the header and footer by changing the address to

<?php> include ('http://www.sitename.com/style/header.php') ?>

However, the CSS formatting was completely off. The positions of the divisions (left, center, right) were skewed. The positions of the links in the navigation bars in the header and footer were justified left instad if positioned in the center. The paragraph tags within a division were not following their positions or inline styling. I am unable to achieve the formatting I want on the live site, despite many hours of trial and error.

What is going on? Why is it that what works in Apache on my laptop is NOT working in Apache on my service providers server (One and One)? Please help!

Check your file case. In other words, if your folder/file is named Style (uppercase "S"), make sure you are not using
< (...) href="../style/style.css"> (lowercase "S")

Hielo,

Thank you for your prompt reply.

On my laptop I did check for case and found that my Apache server was case INsensitive. I have NOT checked for case sensitivity on my live site server. I will do that later today. I have upper case first letter for the folder names. I am pretty sure I used all lower case in the file paths. It has never been a problem for linking the different pages of my site.

Still, the layout is messed up. If you are correct, then I have a second problem with how my CSS layout is being rendered in HTML.

IF your /Style/ folder is directly under your DOCUMENT_ROOT - ex:
http://yoursite.com/Styles/ then instead of using ../Styles/ start the path reference with a slash - meaning, drop the dots. That way the search path will begin from DOCUMENT_ROOT: ... href="/Styles/styles.css"...

I tested my site's server for sensitivity to case in the file paths. I discovered that it is. Matching the folder name EXACTLY, case included, solved the problem of not finding the layout files.

That leaves the problem of my CSS formatting is so messed up. I actually discovered why. I ask for help in another thread.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.