PHP - links and modification of links
<p>Well, I'm editing WP theme and creating network so I need to get url and modificate it for use in <code>&lt;a&gt;&lt;/a&gt;</code>tags.
I created function called <strong>urlbg();</strong> and on normal domain (like www.xyz.com) it works but in subdomain it don't work.
I called functions in <code>&lt;a&gt;&lt;/a&gt;</code> tags like so:</p>

<pre><code>&lt;a href="'. urlbg( 'ark') . '" title="ARK: Survival Evolved"&gt;&lt;img src="'. content_url() .'/themes/newsgamer/images/ark.png"&gt;&lt;/a&gt;
</code></pre>

<p>Problem is, in normal domain (like www.xyz.com) when i use functions eg. <strong>urlbg( 'ASD' );</strong> i get <strong>ASD.xyz.com</strong> and thats what i want, BUT in other way when i use the same code in subdomain (like foo.xyz.com) and when i called function in <strong>urlbg( 'ASD' );</strong><code>&lt;a&gt;&lt;/a&gt;</code> tags, i get <strong>foo.xyz.com/ASD.</strong> (but need <strong>ASD.xyz.com</strong> ).
Sorry for my bad English I hope you'll understand me and know whats my problem.</p>

<p>Code of function urlbg();</p>

<pre><code>   function urlbg($prefix){
                $siteUrl = get_site_url(); 
                $url = str_replace("http://", "https://", "". $prefix . ".", $siteUrl);
                return $url;
            }
</code></pre>