How to use a different mirror of macports rather than the offical mirrors?
I guess you wanted to use a mirror for the binary archive , while the linked question on Stack Overflow is only about the port metadata. So instead of looking at /opt/local/etc/macports/sources.conf, you should be looking at archive_sites.conf under the same folder. The default content of that file is at GitHub; see the file comments for usage.