Drupal 7. Replacing core links with their aliases in theme templates I want to check all templates before rendering and replace links 
node/1 node/3 ect to their aliases

For example, i have main landing page template
page--front.tpl.php
and there are some links in this template:
&lt;a href="node/1"&gt;Contact&lt;/a>
I want drupal to dynamically change such links to their aliases:
&lt;a href="contact"&gt;Contact&lt;/a&gt;
So, if i change alias for specific page, all urls will remain correct

Is it possible?
Not sure if this is what you're after, but
in your tpl.php file you can change

&lt;a href="node/1"&gt;Contact&lt;/a&gt;


to

&lt;a href="&lt;?php print url('node/1');?&gt;"&gt;Contact&lt;/a&gt;