CSS/HTML files updating on Cpanel but not on website

I was changing a few files (not using FTP) on Cpanel. At first the changes I was making to the CSS HTML files were being shown on my site, but now they are not. I have cleared my browser cache, restarted my computer, used an incognito window. Nothing is helping. I even asked my CPANEL support, they said there is an issue with my .htpaccess file, but I can’t even see that final anywhere on my file manager let alone edit it. I am doing basic edits on css (font size changes, alignment etc) so I don’t know if there is an issue with the coding?

Dot files are hidden in CPanel by default. At the top right of your CPanel’s file manager should be a settings icon, click it and toggle “Show Hidden Files (dotfiles)”

Then paste your htaccess file here, it’s really weird that your styles aren’t being updated. Also check your dev console (in Chrome it’s CTRL+SHIFT+J) and see if there are any 404 errors.

this is what is in the .htaccess file:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

And I’m on a MAC, even if I open Chrome, when I do CTRL SHIFT J nothing happens.

That looks good. Do you have any caching plugins and are you sure you’re editing the right theme file? Some themes have a dummy style.css that is never actually loaded. If you have a link that would help too.

On Mac it would be CMD+Shift+J…or just right click and “Inspect” and then click on “Console” in the tab that opens up:

You’ll see a red x if you have errors followed by a list of errors.

Smells like cache to me.

One trick you can try is make a change to the css using a keyword you can search for, like make up a comment like /*SUPERXCOMMENT*/

This will let you search the source easily for your unique word.

Then look in webtools for the HTML header where your css file is loaded. Wordpress tends to add a version number to the source file. The point is, find the path to the file and open it by itself in a browser tab. Open the direct URL to the CSS file and see if your unique word or recent changes are in there.

If your recent changes are NOT there, then play a trick on the URL by changing the path a little. For example if the path was /themes/mytheme/assets/custom.css or whatever it is, change the version and do something like /themes/mythemes/assets/custom.css?v=1234567

By changing the URL in this way, it would bypass any kind of cache that would be looking for the previous URL. In other words, you should now see your correct CSS file.

If this trick works, then there is a cache in the way for certain and it’s not your browser, it’s wordpress or your hosting company.

Nope I am editing the correct file as before it was all going through. And its all basic css things. also when i expect elements it says 0 errors.

did that, the super comment came:
“.gwd-inactive{visibility:hidden}
.gwd-div-1t7f {font-size: 18px; white-space: nowrap;left: 0px;}
.gwd-div-h2tl {font-size: 50px; padding-right: -2cm;}
/SUPERXCOMMENT/
.gwd-div-1scs {padding-bottom:1.5cm;}
.gwd-img-icxg {padding-left: 1.5cm; max-height: 140px; max-width: 140px;padding-top: 2.1cm;}”

but still no changes to the file, as you can see i have font-size set to 50px to test if it changes the size, still no changes. Even tried changing file name to no avail.

If I change the corresponding html file it changes on the website, just not css.

Just a word of caution about editing .htaccess. Don’t edit .htaccess directly in cPanel. It is very easy to mess things up and break the whole site with 500 errors if you don’t know what you are doing (and sometimes if you think you do).
FTP the file to a local disk and make a back-up before changing it. It’s best to edit and test in a local Apache environment if you have that set up.

One trick I use to avoid css cache issues is to timestamp the CSS file via PHP. A common include with have:-

$csstime = filemtime($_SERVER["DOCUMENT_ROOT"] . '/css/style.css'); // when the css file was modified
$csstime = date ("Y-m-d\TH-i", $csstime); // Format as timestamp

Then in my HTML template I have:-

<link rel="stylesheet" type="text/css" href="css/style.css<?='?'.$csstime ?>">

Which will appear in html like:-

<link rel="stylesheet" type="text/css" href="css/style.css?2017-06-27T17-07">

This will force a CSS update, but only if the file has been updated since the last time the page was viewed. If it has not been updated, the timestamp is the same so the cached version is used.

Then there may be a specificity conflict somewhere.
Have you tried examining the affected (unaffected) elements with Inspect?
That should tell you exactly what styling is being applied and from where in the style sheet, as well as any that are being overridden.

Did you see the special comment by just opening the CSS URL in the browser? Or only after changing the “?v=123456” on the URL?
If you see the correct CSS file without messing with the URL, then the problem is something else. Could be specificity issue, or a media query perhaps.

You can always try to put “!important” on a CSS value to see if that makes it work.

As a very last resort. :grimacing:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.