Well... first, I would test to see if .htaccess or web.config etc. even
exists -- that’s not a sure-fire test, but 90% of the time I bork friendly URLs because I deleted that file or forgot to copy it because I used a GUI program to copy only *visible* files. So that could be one test to produce a warning like "Dude, I don’t know what web server you are using, but we can’t figure out how you are making your rewrites work, and that could mean your friendly URLs are broken".
But a more elegant test that avoids directly testing the specific webserver process altogether might be something like this:
Use
file_get_contents() (or curl) to request any aliased page on your site (not the 404 page or the home page). Then compare the rendered contents of this page to the MODx rendering of that page using the xPDO API. The two strings should match if the public page w/ friendly URL matches the internally generated page.
E.g.
// Pseudo code here
$what_the_world_sees = file_get_contents('http://mysite.com/some/page');
$what_modx_sees = $modx->somePageGettingFunction(123);
// strip out whitespace ?? Other cleanups to make for better comps?
if ($what_the_world_sees != $what_modx_sees)
{
// throw error
}
Caveats might include Plugins that inject modified content into the page if you are logged into the manager. Maybe the test should request the page via the normal friendly URL and via index.php?id=123 and compare the strings generated by that.
Alternatively, you could examine the $what_the_world_sees string to see if it contains any known Apache/IIS/nginx error messages, but I think the above approach would be better.