If you want to make the route / optional
'archive(?:/(\d+))?'
A note about the above regular expression. It uses one of the "expression syntax" which uses ?:
This means that every digit inside (?:) will NOT be group and outputted separately.
Consider this:
$t = 'archive/1234';
preg_match('#archive(?:/(\d+))?#', $t, $matches);
//outputs
array(
[0] => archive/1234 [1] => 1234
)
Whereas without ?:
$t = 'archive/1234';
preg_match('#archive(/(\d+))?#', $t, $matches);
//outputs
Array ( [0] => archive/1234 [1] => /1234 [2] => 1234 )
notice that if you include ?: that the "/1234" did not get outputted.