在href中添加了斜杠

I'm woundering how it's possible, this is my code:

echo '<span class="store_url">'.JText::_('WEB').': <a href="'.$item->store_url.'" target="_blank">'.$item->store_url.'</a></span>';

And in the output I get:

<a target="_blank" href="/www.website.com">www.website.com</a>

In href and link are the same values: $item->store_url How it's possible in href there is extra "/"? It's joomla site, and I have standard joomla .htaaccess, but added redirection from http to https:

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

I guess this is Joomla or some plugin for it? In your Joomla control panel or plugin configuration, you can set the URL to your own site. You have probably entered www.website.com there. You should actually have entered http://www.website.com. Joomla or the plugin uses that value to build internal links in the website.

The problem you have is that browsers see URL www.website.com as a relative path to the current page's path. If it was http://www.website.com/, browsers would have seen it as an absolute path.

The page where the browser has found this link is in the root of the domain. Probably http://www.website.com/ itsself or http://www.website.com/something.php. So the browser himself adds the leading / to the relative URL, to indicate the path is relative to the root of the domain. (You are seeing the / in the rendered HTML Source, as interpreted by the browser. Just look in the original HTML Source, you will not find a leading / there.)

Linking relatively from http://www.website.com/ to /www.website.com will end up at http://www.website.com/www.website.com.

In closing: the lesson here is, when installing and configuring some 3rd party software, always pay very close attention to the settings you are setting. And when possible consult the manual!