Force non .html to .html

Hello, I’m trying to point all requests that are not ending in .html to .html (obviously without affecting sitemap that ends in .xml).
Right now any address that ends without the html are pointing to 404 error.
Friendly url is active and everything is working fine just have that little problem.

Can anybody guide me?
Thanks!

you could try to use a plugin, which fires at OnPageNotFound with sendForward or sendRedirect, something like that:

<?php
if ($modx->context->get('key') != "mgr") {

    //echo $_REQUEST['q'];die();

    if ($id = $modx->findResource($_REQUEST['q'] . '.html')) {
        //$modx->sendForward($id);
        $url = $modx->makeUrl($id);
        $modx->sendRedirect($url);		
    }

}
2 Likes

Thank Bruno, it’s working fine!