Manish Manish - 9 months ago 26
CSS Question

CSS is not working when I try to style html elements in a php page that includes another php page, which links to the css file

I have a header.php file that contains link to the css file...

<html>
<head>
<title>Welcome</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<header></header>


I have a categories.php page. My index. php page includes both header.php and categories.php, as shown below.

<?php
include("header.php");
include('session.php');
?>
<h3>Welcome <?php echo $login_session; ?></h3>
<table id="cat_feed">
<tr>
<td><?php include("categories.php"); ?></td>
<td><?php include("feed.php"); ?></td>
</tr>
</table>


I have a style.css file that works fine and does affect index.php, but does not seem to affect when i add style to the css file.
The problem is that any new style changes donot affect how my index.php file looks.

Answer Source

This could be to do with Varnish Cache, which is used to boost loading times of your website by caching assets (such as your stylesheet).

To disable Varnish Cache, add this line to your .htaccess file:

Header set Cache-Control "max-age=0, private, no-cache, no-store, must-revalidate"