Thread Starter
georg
(@fertila)
Hi Shivam,
thanks a lot for the reply and the hint.
I had a look in the documentation already and tried to exclude ^news.fertila.de/feed/
However this does not work. The only way I could see is to exclude my home, which I do not want.
Any other ideas?
Best regards
Georg
Hi @fertila, the setting page Do Not Cache URIs are just working for the same root domain. If you’d like to exclude another domain from cache, you may try the following script, please try to put the following method on theme’s function.php:
if ( method_exists( 'LiteSpeed_Cache_API', 'set_nocache' ) ) {
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
if ( $actual_link === 'http://YOUR_ROOT_URL/' ) {
LiteSpeed_Cache_API::set_nocache( 'Disable root URL from cache' ) ;
}
}
Thread Starter
georg
(@fertila)
Hi @stanleylitespeed
thank you so much for the code snippet.
I put
if ( method_exists( 'LiteSpeed_Cache_API', 'set_nocache' ) ) {
$actual_link = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
if ( $actual_link === 'https://news.fertila.de/' ) {
LiteSpeed_Cache_API::set_nocache( 'Disable root URL from cache' ) ;
}
}
in my functions.php. However this does not seem to work. Anything else I might have to consider?
Georg
-
This reply was modified 6 years, 5 months ago by
georg.
-
This reply was modified 6 years, 5 months ago by
georg.
Did you purge the cache and rerun again? Also, can you check does LiteSpeed_Cache_API::set_nocache run inside the condition?
Thread Starter
georg
(@fertila)
I just purged the cache. How would I check if LiteSpeed_Cache_API::set_nocache runs inside the condition?
You can put an error_log inside that condition to print out something on log or check on the LiteSpeed debug log.
Thread Starter
georg
(@fertila)
I cannot see nocache instances for this URL in the debug log.
Could you try to simply put LiteSpeed_Cache_API::set_nocache( 'Disable root URL from cache' ) ; on functions.php, purge all cache and see does that page loaded without cache hit.
If it’s still not working please join our Slack channel and find me(Stanley Cheung at Litespeed) for reproducing the issue.