Blog Sections Open
Normalizing Repeated Slashes in Evolution CMS URLs
Malformed URLs with repeated slashes are ugly, but the bigger problem is that they can create duplicate paths and undefined routing behavior. The original topic tackled exactly that in Evolution CMS. Typical Check if (st
Malformed URLs with repeated slashes are ugly, but the bigger problem is that they can create duplicate paths and undefined routing behavior. The original topic tackled exactly that in Evolution CMS.
Typical Check
if (stristr($_SERVER['REQUEST_URI'], '//')) {
$g = preg_replace('|[//\s]+|is', '/', $_SERVER['REQUEST_URI']);
$modx->sendRedirect($g);
}
Alternative
if (stristr($_SERVER['REQUEST_URI'], '//')) {
$modx->sendErrorPage();
}
Which Is Better?
Redirecting is useful when the malformed URL is clearly recoverable. Returning a 404 is better when you want to avoid normalizing obviously broken or suspicious paths automatically.
The important thing is to choose one policy and keep it consistent. Repeated slashes should never become a second valid URL shape for the same page.
Fixing phpThumb shell_exec Errors on Restricted Hosts
How to interpret phpThumb shell_exec failures when the host does not allow the ImageMagick command lookup it expects.
Preventing Memory Exhaustion in Eletters Queues
What to check when Eletters or another mail queue process runs out of memory before finishing a batch.