I had a client who was using the “store code in URL” feature of Magento throughout their site. This was working well for them, but there were a few URLs where they wanted NO store code, and I was asked to look into it.
Digging deep into the URL generation code, I discovered the
<global> <request> <direct_front_name> <frontnames/> <here/> <skip/> <store-code-in-url/> </direct_front_name> </request> </global>
There was much rejoicing. Putting a front name here ensured links with said front name were generated without a prepended store code.
Then I noticed it didn’t work for about half the links on the site. It turns out the
<direct_front_name> feature doesn’t work with URLs generated by store directives in CMS/Static-Block templates
A bug? A feature? A bug maintained as a feature to ensure backwards compatibility? Two systems developed by engineers who didn’t or couldn’t talk to one another?
In the end we decided on a quick search and replace through the CMS tables and hard-coded URLs.