The following is an implementation example:
Copy code The code is as follows:
/*
* Pseudo address to original address (url_alter )
*/
function example_url_inbound_alter(&$path, $original_path, $path_language)
{
if (preg_match('|^article(/.*)|', $path, $matches )) {
$path = 'node'. $matches[1];
}
}
/*
* Original address to pseudo address (url_alter)
*/
function example_url_outbound_alter(&$path, &$options, $original_path)
{
if (preg_match('|^node(/.*)|', $path, $matches)) {
$path = 'article' . $matches[1];
}
}
PS: When implementing hook_url_inbound_alter, the implementation function cannot be called out for some reason. It may be because HOOK is loaded prematurely. , the module is not fully loaded. So my approach is to write it in the URL rewriting module, such as subpath_alias
http://www.bkjia.com/PHPjc/323213.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323213.htmlTechArticleThe following is an implementation example: Copy the code as follows: /* * Pseudo address to original address (url_alter) */ function example_url_inbound_alter( } } /* * Convert original address to pseudo address (url_alter) */ funct...