fix(routing): accommodate longer DOI prefixes in URLs

Modified the DOI rewrite rule to accept prefixes with more than four digits. This change ensures compatibility with a wider range of DOIs, preventing potential 404 errors and improving the robustness of URL parsing.
This commit is contained in:
Kumi 2024-06-20 15:55:36 +02:00
parent 85ce309dc2
commit 1d2734bf00
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -372,7 +372,7 @@ add_action('save_post', 'save_article_meta_boxes');
function add_doi_rewrite_rule()
{
add_rewrite_rule('^([0-9]{2})\.([0-9]{4})/([a-zA-Z0-9_\-\/]+)?$', 'index.php?doi=$matches[1].$matches[2]/$matches[3]', 'top');
add_rewrite_rule('^([0-9]{2})\.([0-9]{4,})/([a-zA-Z0-9_\-\/]+)?$', 'index.php?doi=$matches[1].$matches[2]/$matches[3]', 'top');
}
add_action('init', 'add_doi_rewrite_rule');