0 down vote favorite

I am trying to share my products image on Facebook but somethings gos wrong with the URL of the products I used this code on the header of the page

    (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
    fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));

and than I used this for my share Icon

<a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo "https%3A%2F%2F$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; ?>" target="_blank"><img src="images/facebook.png" class="f_right m_left_right_5px" width="30" height="30" alt="facebook"/></a>

I used this PHP code to get the link of the products

https%3A%2F%2F$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]

the link should appear something like this

https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fnadim.org/new2/index.php?pid=v4&prodid=136&cat=1

but in the share box it appear like that

https://nadim.org/new2/index.php?pid=v4

what did I made wrong. thanks

It seems your SSL domain is not well configured, if you browse to the root https://nadim.org/ you get the default page. The index.php page is missing, the new2 directory is missing as well.

By the way, even switching from HTTPS to HTTP it does not work, you need to complete the query string with &prodid=132&cat=1.

Hi cereal the index.php is not missing and the new2 as well but I was mistaking butting https it should be http:// only I don't use SSL but the problem still there

@cereal Thanks very much this really solved my issue.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.