• Home
  • Get help
  • Ask a question
Last post 8 hours 44 min ago
Posts last week 94
Average response time last week 34 min
All time posts 67913
All time tickets 10496
All time avg. posts per day 20

Helpdesk is open from Monday through Friday CET

Please create an (free) account to post any question in the support area.
Please check the development versions area. Look at the changelog, maybe your specific problem has been resolved already!
All tickets are private and they cannot be viewed by anyone. We have made public only a few tickets that we found helpful, after removing private information from them.

#4340 – Programmatically clear cache and regenerate URLs?

Posted in ‘sh404SEF’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Tuesday, 21 November 2017 07:39 UTC
iage
Hello,

Is there a way to programmatically clear the cache and/or force sh404sef to regenerate URLs?

We have a script that is called via Cronjob and creates items for the Joomla-extension Zoo from Yootheme (com_zoo).

The script deletes old items, recreates existing ones and creates new ones directly in the database.

The content is shown in the frontend in the overview page, but clicking through to items often leads to a 404-message.
After manually clearing the Joomla-Cache or purging the URLs, the content shows fine, so ideally, we'd like to automatically clear the cache and purge URLs after the script has run.

Kind regards, Stephan
Tuesday, 21 November 2017 08:17 UTC
wb_weeblr
Hi

After manually clearing the Joomla-Cache or purging the URLs
Those are 2 different things.The key point here is purging the Joomla cache, not purging the URLs. Until you purge the Joomla cache, the old links are displayed to visitors (because the page content has not been updated) and so they get 404.

When you purge the Joomla cache, then Joomla rebuilds the page use the new items, with their new URLs.

Removing the URLs from the DB would be useful, as they are just a waste if the items have been deleted, but that won't help solve this particular issue.

Instead of purging the URLs, which deletes everything and will cause 404s for other URLs as well until the URLs have been rebuilt, I would suggest:

1 - make sure the "URL disk cache" is disabled in sh404SEF config
2 - When you cron job deletes K2 items, it should also delete all URLs related to that item from the sh404SEF #__sh404sef_urls database table.

That way, you simply remove the URLs that won't be needed any longer, and keep the good ones. Again, your first problem is to clear the Joomla cache.

Rgds
 
Tuesday, 21 November 2017 08:49 UTC
iage
Thanks for the fast reply! I'll give it a try.

Kind regards, Stephan
Tuesday, 21 November 2017 08:56 UTC
wb_weeblr
Hi

I will leave this ticket open in case you need to add something. It will automatically close in 2 weeks if no further comment is made.

Best regards
 
Wednesday, 06 December 2017 05:34 UTC
system
This ticket has been automatically closed. All tickets which have been inactive for a long time are automatically closed. If you believe that this ticket was closed in error, please contact us.
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.