We have already expressed that we are not very big fans of sh404SEF – we think that this extension does more harm than good for what it does. But, the fact of the matter is, there are thousands of Joomla websites using it, so, whether we like it or not, it’s part of Joomla’s ecosystem and we have to work with it and, of course, address its many different issues.
One of the major issues that sh404SEF has is that links are only generated when the page linking to them is visited. Let us explain what this means in plain English… Let’s say you have an article on your website that is only accessible from Page 26 from a certain Category Blog view. For that article’s link to be valid, one has to visit Page 26 on your website. If that page is not visited, then Joomla will return a 404 error for that article’s link.
Now you might be wondering why would the above be a problem. Well, if you just migrated your Joomla website and you have a fresh install of sh404SEF (with an empty database), or, if you have just Purged all the URLs in sh404SEF (by logging in to your Joomla’s website backend, and then clicking on Components -> sh404SEF -> Url Manager, and finally linking on Purge on the top right) then most of the links on your website will not work because the pages linking to them will need to be visited for these links to be re-generated. Of course, if you just have a few hundred articles then you can do this job manually (visit all the main pages yourself), but what if you have tens of thousands of articles? Will you be willing to spend literally a whole couple of days visiting Category Blog pages to re-generate all these links?
If the answer to the last question is “No”, then fear not, there is a way to address this problem. All you need to do is to temporarily change the value of Leading Articles or the value of Intro Articles (or both) in the menu item of the each Category Blog view (or the type of view that you are using to list your articles) to a very high number – say 1,000. This means that on every page of that menu item, sh404SEF will be able to generate 1000 links in one shot! Yes – it’ll take some considerable time to load that one page, and you might run out of memory (if this is the case, then you will need to increase the PHP’s memory limit by applying one of the methods described here), but it’s worth it. If your website has 30,000 articles, then theoretically, you will only need to load 30 pages to re-generate all your links. Not too bad, huh?
Now, there’ll be small issue remaining, which is the pages in each category. For example, when you were showing 20 articles/page for a 10,000 article category, you had 500 pages. Now you only have 10 pages. With the technique above, the links to the 500 pages will be all corrupt. To address this problem, you must temporarily override the pagination.php file (which is located under the libraries/joomla/html folder) in your own template to display the links to all the pages in one shot (so, instead of displaying links to only 10 pages at the bottom, you will display links to 500 pages). Needless to say, you must revert back to the number of articles per page that you originally had (e.g. you will need to change the number of Leading Articles or Intro Articles back to what it should be).
As you can see, this post (especially the last part) is a bit advanced and require some programming skills. If you think it’s a bit complicated and you need help implementing the solution above, then please contact us and we’ll certainly help. Our rates are reasonable, our work is professional, and we know Joomla inside out!