Home arrow sh404 Guide - 2
Install sh404 Guide - 2

Install sh404 Guide - 2

Install sh404Guide - 1                         Page 1 of the guide
Install sh404Guide - 2                           Page 2    [this page]
Install sh404Guide - 3                        Page 3
Visual Guide to sh404 Metadata         A step-by-step guide to enabling meta in sh404

On this page:

2 - Using sh404
sh404 URLs
How to remove index.php from the URL
Flush the cache on sh404
Upgrade errors with sh404
Uninstall sh404
sh404sef configuration unwriteable - error
The Apache file ownership issue
Internal Server Error 500 with sh404
Unresolvable sh404 issues
Using the sh404 metadata solution
Enabling the sh404 meta module
404 errors after installing sh404

2 - Using sh404

sh404 URLs

You can have any URL you like with sh404. Mostly, though, you will be looking to choose between 4 basic choices of 'shape':

  • With or without the /index.php/ in the middle

  • With or without a Section name in the middle

  • With or without a Category level in the middle

  • Any combination of the above

You can also set a Custom URL via the control provided. Pick a page, give it any URL you want. This is not a common method but can be used for one or two pages that need adjusting.

You can choose to remove the index.php, by going over to htaccess file control. You can have a Section or Category level, or both, by selecting that switch in the sh404SEF configuration admin. So your page address could look like this if you chose both Section and Category to show:


...where the Section on the site is titled SEO, and the Category within that section is CMS. Or you can just have a straight page URL with neither:


...though if it has the index.php in (which also works with Section and Category), then it will be:


...which is what we use here. None of these have a huge effect on the SEO so don't waste too much time on it. It helps to get the page name relevant though.

How to remove index.php from the URL

How to change /index.php/ to no index.php -- the default startup condition now for sh404, after you enable it, is to work without an htaccess file. You can leave it like this if you like (we do, on this site). It has no effect on search engines for example - we have around 50 #1 or #2 global search results here, on this website, so obviously the search potential is unaffected. The URL will look like this:
You'll see it has an extra level in the middle that looks out of place and could be removed. As stated, you can leave it like this - and we do, since we like the fact it works entirely within the CMS and doesn't use an htaccess file. It's greener :)
Many people will want to fix it though. That means you must use an htaccess file. In the past this was the default, but so many people had problems just getting the plugin to work the developer got tired of it and changed the default, so that it always works - but it has an extra level within the URL.
You will now be using the Apache server rewrite function (the server rewrites the URL to a better format). This is enabled within the server local configuration file, called the htaccess file. First we will check to see that the built-in Joomla SEF / htaccess solution works. If it doesn't, there won't be much point going any further, sh404SEF certainly won't work.
First switch off sh404 if you had it enabled. We now want to check the core SEF solution works, as a first job.
1. In the standard Joomla htaccess file, you'll see that the core SEF rewrite section - 'Begin - Joomla! core SEF Section' - at around lines 66 to 78, is uncommented and therefore live and operational. That htaccess file should be in your server webroot, with all the other Joomla files and folders.
2. Go to your backend admin >> text menus at top of page >> Site >> Global Configuration >> SEO tab at far right >> check 'Yes' for Search Engine Friendly URLs.
3. Turn off sh404 - go to Components (text link at top in admin) >> sh404SEF >> sh404SEF Configuration (top left blue icon) >> Main tab >> enabled = No

4. Check the livesite (your working website). Now, it should have different URLs showing. They will be shorter and definitely better than the initial 'raw' URLs. But they can be improved.
5. Now go to your htaccess file again. MAKE A BACKUP.
Comment-out the Joomla Core SEF Section at lines 66 - 78.

(Insert a hash symbol [#] at the start of each line.)
6. Uncomment the 'Begin - 3rd Party SEF Section' at lines 82 to 92. Actually you don't uncomment all of them - just do the lines of working script of course, which are from 86 to 90. Those are the lines with a single hash (#), which you remove to set that line live. The server now reads it.
7. FTP the changed htaccess file up to the server and overwrite the original.
8. Go to your admin backend, to the sh404 configuration.
In the admin backend >> text menu at top >> Components >> sh404SEF >> sh404SEF Configuration (the top left blue button) >> Main tab >> Enabled = Yes.
Then go to the Advanced tab >> Advanced Component Configuration >> Rewriting mode >> change spin box selection, to 'with htaccess (mod_rewrite)'.
And you're done. Check the livesite. You should now have SEF URLs that look like this:
...or if you've selected 'show category' then you'll have a category name in the middle. 

Flush the cache on sh404

After making any URL changes you may need to flush the sh404 cache before you can see the effect on the livesite. The cache (say 'cash') is the memory pool - URLs are held in memory so that the server response is quicker; but if you change something the old version is still in there and still served.
Go to the sh404 control panel and clean out the cache:
In the Joomla admin backend >> Components (on top text menu) >> sh404SEF >> Purge SEF URLs (blue button icon on left).

The cache is now empty and the new information will be loaded. However, there's a problem: you won't see any new pages / URLs, until the item has appeared on a menu somewhere, and been displayed on a page requested and served. So your new page, or page with a new URL, will just get a 404 error.
What you need to do is two things:
1. Have the new page appear somewhere on a standard Joomla menu (and not a text link within content -- that doesn't count).
2. Click through the site until you've seen all the menus.
Make sure you've clicked through to all pages that display a discrete (separate and different) menu. A simple way to do this is to run a sitemapper. After you've done this, the new pages will show up.

Until you do it, some pages will get a 404 error (not found).

You don't have permission to access this page
Joomla plus sh404SEF also has an 'alternative' 404 Error message: "you don't have permission to access.....". Essentially it's a 404, and you will get it when:
  • A page has been unpublished. The URL is correct, the page is there, but not viewable.

  • A page is restricted to Registered or Admin-level visitors only. It's there but you are not allowed to view it.

  • A page is not fully 'operational' for some reason. For example, you just flushed the cache, but you haven't yet reloaded the cache by displaying every single Joomla menu on the site. Some pages are not fully visible yet.
These circumstances vary. This message is basically a type of 404 that tells you the page is there somewhere, but the publishing parameters or similar are not 100% right.

Upgrade errors with sh404

Upgrading is not always simple with this component. It's not a problem, there are ways to mitigate this. Firstly, you need to carry out the correct procedure:
1. Perform a full database backup. At least TWO FULL SEPARATE WAYS are necessary to ensure that you have a good working backup. Always test out a new way of obtaining a DB backup to ensure it works: import it to a website and see if it runs correctly. Check a backup in this way monthly. For instance you could use a phpMyAdmin backup via your control panel; and a PU_DB-admin backup within Joomla. We use these and know they work. We have had problems with other popular solutions.
2. Go into the admin backend.
3. Backup all your data: export all your SEF URLs and save them. Export all your Meta tags and save them. Export any Custom URLs or Meta and save them.
4. Go to the sh404 configuration parameters and ENSURE that the default setting, maintain config parameters on upgrade, is still checked.
5. Go to Installers - Components. Look down the page to the list of components that are currently installed. Check the box against the sh404 component. Go to the top right and Uninstall it.
6. Via Installers - Components, install the new sh404 version - browse to the zip file on your PC, 'Open' it, Upload & Install it.
This is the correct procedure and should install the component (and associated module) correctly. Uninstalling the old version does not lose the configs or the SEF URLs (normally!). 

Upgrade errors

Sometimes errors are encountered. Often these are the result of not uninstalling the old sh404 version first. Although this is not in theory necessary, it always works best.
Here are typical Upgrade Failure error messages:
Failed to copy file:
sh404sef configuration unwriteable
The reason that an upgrade install frequently fails is because uninstallation of the old version did not complete correctly within the upgrade process. The old files are still occupying the webspace that the new files require. This can happen because of file permission settings and other server peculiarities that prevent a smooth upgrade taking place. Therefore, it's best to uninstall the old version manually first. And if that fails, you can go in via FTP and delete the folders yourself.
In the 'Failed to copy file' example above:
Delete these directories via FTP.
Check server file permissions are OK (ie, open them up a bit if necessary).
Reinstall the new sh404 version.

Uninstall sh404

As stated, sometimes you may have to uninstall sh404 totally in order to upgrade. First, perform a manual uninstall and upgrade. If this doesn't work, then you can delete all the sh404 files via FTP. All these should be deleted:
  • the folder (= directory): components/com_sef
  • the folder: administrator/com_sef
  • the files: shCustomTags.php, shCustomtags.xml -- these are in /modules/
  • any file or folder with sh404sef in its name in the /media/ directory (they are used for holding configs while upgrading)
After this you should be able to reinstall or upgrade. 

sh404sef configuration unwriteable

Another reason for upgrade or config failures is that file permissions are too tight. You don't have high enough permissions set on the files in order to write to them. You can change this in the CMS backend (Site >> Global Configuration >> Server tab -- file permissions); or via FTP; or via the server control panel (cPanel, Ensim) File Manager. If this doesn't work then it could be that your server settings are not correct - the file ownership setting is wrong.

But try uninstalling / deleting the old sh404 version completely first. You shouldn't lose any URLs or meta, they are in the database and the new sh404 version will retrieve them. I have never lost any data when upgrading, even when I had to delete files and folders via FTP. But you could play safe and get a DB backup though.

The Apache file ownership issue

Files on an Apache server have two settings: the file permission and the file ownership. If you cannot change the file permissions (or even delete the files), then the file ownership settings are wrong. You can check this using the FileZilla FTP client - as well as file permissions, this excellent FTP app also gives you the file ownership info. What happens is that files installed via the CMS have different ownership to files uploaded by FTP or cPanel. Your host must fix this for you, if wrong. This often occurs on a dedicated server, where all the server settings are not fully completed, as the owner has root server access and in theory is managing it.

You will normally find that Level 1 hosts' tech support staff cannot fix this - they are the first-line support staff. The issue must be elevated to Level 2 or Level 3 as a more experienced server tech is required for this issue.

Internal Server Error 500 with sh404

If you cannot access the site and you get a 500 error: what did you just do?
Chances are you just changed the htaccess file, as this fail error normally results from an incompatible line in here. Replace the htaccess file with your backup, or comment-out the line you just changed.
You'll find that one line of your htaccess file is faulty (for that particular server) and does not permit correct operation. You could try the htaccess file for sh404 we give you right down at the bottom. It's a lot clearer than the default 3PD version that comes with Joomla (even though it's identical of course), as we ditched all the junk.

Unresolvable sh404 issues

In every case we have seen where the SEF URLs or meta didn't work, and none of the preceding methods solved the problem, it has always been a compatibility problem with another plugin. Some webmasters get 30 plugins, some of major size and effect, then last of all try to install the sh404 component.
Since the SEF URLs are the most important factor for every site (if you want any traffic), you should install this FIRST. Then worry about the other stuff.
If you follow this methodology you won't have any trouble. So install sh404 first - then other components, one by one, testing as you go - and things will be fine. If there is a problem at any stage, you can see PRECISELY which plugin caused it.
If you've got problems with a big site, with lots of plugins, after you install sh404 - then you can try unpublishing the other plugins to see which is causing the glitch. Maybe you'll be lucky. If necessary, unpublish absolutely everything, then republish them one by one, seeing how they work with sh404.
But you might find the only solution is to uninstall everything - reinstall sh404 - then reinstall each component. That is the best policy in the first place.
The SEF URL solution has priority over everything else and you need to remember that. Ideally, a full SEF solution would be in the core - but the Joomla philosophy is basically that the CMS is a framework, and everything will be achieved with plugins. This is a good system because it means you can install any features you need, and uninstall those you don't like. A CMS with integral features is often flawed because those features are not optimal for all purposes - they cannot be. Just ensure that you prioritise for the SEF solution. Any other method may cause issues.

As previously stated, there is one exception: the Joomfish language plugin must be installed first.

Using the sh404 metadata solution

The plugin also includes a custom meta solution, in the form of a module, that allows you to create perfect, unique metadata for each page of your site.
The advantage of this, of course, is that this has unbeatable value for SEO, since it is one of the primary requirements - boilerplate meta is useless.
The disadvantage is you'll have to fill the metatags for each page manually... 

Enabling the sh404 meta module

See this Visual Guide to Using sh404 Metadata

By default, the module is not published - ie it is disabled. That means you still have your global metadata running.
To fix this you need to do two things:
2. Publish it.
The module has to come in last or it won't work correctly. However, sometimes you'll find it can't be placed in the absolute last position (such as Debug) because it leaves a 'ghost' module shadow - a small placeholder that shows a module is published there, but without any content. If that happens, then just come back up one module position, and put it in there, at one position higher.
If there is already something in that position, that's OK, put it in there as well - but place it last, after the other item in the same module position. This is done in the Module Manager list, by numbering it below the other item, AFTER you save and exit from the sh404 metadata module. Simple when you know! 

404 errors after installing sh404

It is normal to get 404 errors immediately after installing sh404. This is because the URL cache is empty. You must click through all the pages on the site that display different Joomla menus. After all menus have been displayed, the cms has built a cache of all SEF URLs needed. One way to do this, on a large site, is to use a sitemapper. What you have to do is display (or otherwise serve) every menu on the site - then all the pages will have had their URLs 'read' and stored.

Text links and sh404
Joomla CMS + sh404 does not work if pages are only linked via text menu links, ie hyperlinks within the text, and not in an 'official' menu. If a page is only linked via a text link, potentially it will not function correctly. There is a simple workaround for this if you have pages only connected via text links: create a menu for all such pages and display it at the back of the site somewhere, or visible only after login. This solves the issue easily. Don't forget to bring up the page with that menu on it, after doing any maintenance that involves flushing the URL cache - otherwise some pages will be dead and get the 'You do not have permission to access this page' message.

Subsequent 404s
After an sh404 install, if you look in the website statistics a day or so later, there should not be any 404 errors - 'page not found'. This is because although the URLs are now different (assuming you've enabled sh404 of course), the component should automatically redirect the old URLs. If everything is working as normal, and configurations in sh404 are correct, old addresses will be redirected transparently.
Make sure that you have the correct config set: in sh404SEF admin >> sh404SEF Configuration >> Advanced tab >> 301 redirect from non-sef to sef URL -- checkbox = Yes
 However if you did some experimenting, and changed the addresses somehow for an hour or two, then you may have been indexed during that time. Some pages will now be incorrect in a search engine's index.
If the page addresses are different, then the search engine index data is wrong. The links, of whatever type, are now wrong and will get a 'page not found' message when someone comes to the site from one.
You resolve this problem by adding some entries to the htaccess file, called redirects. These will redirect visitors to the new page address safely. Eventually search engines will index the new pages.
This is the entry that must be added to your htaccess file FOR EACH PAGE that turns up as a 404 error. Two pages have been redirected here:
## page redirects, old page >> new page
Redirect 301 /index.php/guide-to-htaccess.html http://www.a3webtech.com/index.php/htaccess-guide.html
 Redirect 301 /option_com_widgets?id5&viewid99 http://www.a3webtech.com/index.php/widgets.html

You can see the 'comment' that tells you what the following script does; it redirects an old page address to the new one. The script lines are all on one line, but may be broken up by the page width. The first example shows that we used to have a page called guide-to-htaccess.html but changed it to htaccess-guide.html
The second shows a page, option_com_widgets?id5&viewid99 has been redirected to widgets.html
In theory sh404 will redirect these old page addresses. If 404s are still happening, maybe you had some other page URL format showing for a couple of hours and that got indexed by a search engine. Whatever shows up as a 404 in your error logs, redirect it.
Look closely at the URL that failed and see if you can tell how / where it originated.

Part 2:  >>>  Install sh404Guide - 3  --  Part 3 of the Guide

Web Business Managers