Php caching and possible generation of static files - php

Im running a website through the basics of a wordpress setup.
For some reason the pages/files are being cached somewhere. I haven't been able to find any static file generation but for example when i log out from a user it doesn't regonize that all cookies has been destroyed.
Also updating stylesheet and the core .php files may take a few refresh before appearing on the site.
I'v tried to set up filematch in the .Htaccess with an expiration date before the present (i had it to 1998).
Also tried inline php at the first line of my .php files to setup headers with nocache information.
None of the above has worked.
Any suggestions or clues would be much appreciated!

Also updating stylesheet and the core .php files may take a few refresh before appearing on the site.
For that when you do any change in CSS/stylesheet/JS file then after stylesheet file string pass version number like below
Before
https://stackoverflow.com/style.css?v=1.2
After
https://stackoverflow.com/style.css?v=1.3
So page caching issue is resolved.

Related

Wordpress site failes to load js and css

I have this weird problem with my Wordpress Website. I worked on localhost and afterwards I tied to get my site online but i modified some configuration files and i don't know witch one is the fault. I am using XAMPP. The website right now is seems to not load js and css. Also on console log it gives 404 error for not fiinding the files it needs.
Landing page:enter image description here
Another Page:enter image description here
do you use gzip compression or such as it? if yes try to disable it, and make sure you have the right path
First, check that the file permissions are correct.
Also, if you have changed anything on your .htaccess files, overwrite them with the default ones: https://github.com/WordPress/WordPress
Also it's always a good idea to go to the permalinks page (/wp-admin/options-permalink.php) to update the links of all dependencies to the new URL.

CSS file is being cached even after clearing cache and changing the CSS version

I have a css file and to test it, I added some code to the bottom that just changed the color of a small section on the site. It took about 15 minutes but eventually it loaded and updated the CSS. Then when I removed it to see how long it will take to come off again, the code still loads and it has been about 30 minutes. I tried clearing my browser cache as well as changing the version of the CSS file. The version (when I inspect the source code on the browser) is updated to v2 like it should be but the file still contains the code from v1. Would it be because of the host caching the file or something? When I ran into this problem before, changing the version of the css file worked but it is not this time. Any help would be much appreciated. Thanks!
Oh as another note I am using the below code to enque the css file and it is in WordPress:
function my_theme_styles() {
// Enqueue our style.css with our own version
wp_enqueue_style('child-theme-style', get_stylesheet_directory_uri() . '/style.css',
array(), '202107v1');
}
I also know there are other things on stackoverflow but they all just say to either clear the browser cache or to change the version at the end of the css file which both options I have already tried with no success.
#Sahriar Saikat mentioned in the comments that it could be cloudflare caching the file and he was right. I checked the settings in cloudflare (which I didn't have access to until today) and found that they were using the query level "ignore query string" which was making it not update. Thanks for your help!

file path from the url disappears on redirect

I am still very new to Moodle. I have tried to set up Moodle since this week but it is not working well. I have installed all the underlying server apache and mysql. I have also enabled the required extensions in the php.ini file:
php_curl.dll,
php_fileinfo.dll,
php_gd2.dll,
php_intl.dll,
php_mbstring.dll,
php_mysqli.dll,
php_openssl.dll,
php_soap.dll,
php_xmlrpc.dll.
However, whenever I want to navigate to another page or clicking the log-in button, I get this page here where the php extension is dropped all the time. So, what you can see is not the moodle site, but just a hierarchy of files. I always have to manually augment the url by the php part, but this is not a solution.
I hope you can help me out. Thank you very much.

Migrating Wordpress to a site with a subdirectory

I've migrated many Wordpress sites before, but now I'm having an issue I just can't seem to solve. Some, but not all of the links are not loading properly.
I'm migrating from local.dev to example.com/test.
In my database options, I have both options set to example.com/test.
I doubled checked the options in the WP backend, and they're example.com/test.
I've updated my permalinks.
All of the pages work, all of the links work, but a few references to images, etc do not - they're loading example.com/ instead of example.com/test.
I think it might have to do with the .htaccess file, because I can't update it from the FTP side. If I delete it and update permalinks, no .htaccess file is created. I don't have access to any server side overrides, only the files.
In my MAMP vhosts, I have SymLinks Override set to All, but I can't edit anything like that on the live host.
The links that aren't working are along the lines of $image = get_post_meta(37 ,'_my_meta',TRUE)['img']; which should return
http://www.example.com/test/wp-content/uploads/image.jpg
but instead returns
http://www.example.com/wp-content/uploads/image.jpg.
Using bloginfo('wpurl'); returns http://www.example.com/test, and all similar ones return properly (site_url();, 'template_directory', etc.
In the end, the site is going to go on http://www.example.com without the subdirectory anyway, but I'm sure I have to get it to work properly to prevent future errors.
I also updated to the newest version of Wordpress at some point, not sure if that could cause any issues.
I believe the issue deals with media and links placed in content items.
I use to do some manual SQL queries to fix this but now I run this plug-in https://wordpress.org/plugins/automatic-domain-changer/
The plug-in will go through all the content and make the needed changes.
The links that aren't working are along the lines of $image => get_post_meta(37 ,'_my_meta',TRUE)['img']; which should return
http://www.example.com/test/wp-content/uploads/image.jpg
this meta information is stored in the DB. then to make the migration you have to change all the old URL in the DB before to import it in the new place

Joomla moved, now index.php redirects me to root folder

A friend of mine asked me for a favour, to move his website. The programmer who made it, send me an archive with the database, and the rest of the files needed. I've installed it on my localhost, with apache, php and mysql installed on it.
I have a problem with it. If I go to localhost/mgro/index2.php, it shows somehow a minimal version of the website, but if I click on something, it gets to index.php?something_else_here and it works. If I go to localhost/mgro I just see the files, and if I go to localhost/mgro/index.php it redirects me to localhost/mgro.
About the configuration file, I've used the configuration.php-dist file, with new info in it. What I've changed was just the database, user and password for the database.
Basically, everything works fine, except that index.php with no requests, because it "backs" me into the folder
NEW PROBLEM: If I click on an Add to cart button, it redirects me to the website that is online.
Is this Joomla 1.5 or Joomla 2.5.x / 3.0? I'm going to guess that you have a potential issue with the live_site variable in the configuration.php file, especially if you're using Joomla 1.5. Make sure that it is configured to your localhost's live site URL directory.
Some other things to check:
1) If you're using SEF urls you need to use a .htaccess file. Usually the one Joomla' includes by default works (if you don't have it you can redownload it from Joomla's code repos: http://joomlacode.org/gf/project/joomla/frs/?action=index
2) When logged in go to global configuration and check the option "URL rewriting". You can try switching it off. (On does require the .htaccess file mentioned before).
3) If you're just seeing files when you hit the directory then Apache isn't configured to load .php files. Since you're running a localhost you'll have to track that down somehow.
Some other notes:
-Index2.php isn't anything, don't use it.

Categories