The other day I ran into an issue with Joomla’s mod_rewrite functionality and an older version of PHP. If you run into the error: Error 500 – PHP regular expression limit reached, you are most likely running a PHP version somewhere within 5.2.0 and 5.3.6. What is happening is that Joomla uses regular expressions to make the URLs prettier, and has an expression limit which is far too small for most sites. With larger sites (those which have many nested categories), you may be getting this error with the newer versions of PHP as well.
In the aforementioned older versions, the pcre.recursion_limit defaults to 100,000, but since 5.3.7 this has been changed to 1,000,000. These settings can be changed in the server’s php.ini file, but if you have shared hosting, you’ll need to use PHP’s ini_set function somewhere within your Joomla site to edit this.
I initially edited Joomla’s root configuration.php and added the following:
This can be put in any file that is read on every page load (index.php, template’s index.php, configuration.php, etc.). Since updates don’t affect the config file, I felt this was a safest place to put it.