Avoid Facebook's share link redirection - php

I have an empty page, that does one custom tracking function, then redirect back to facebook.
http://example.com/promotion/?promotion-id=12
What's inside the link is:
if(isset($_GET['promotion-id'])) {
addTracker($_GET['promotion-id']);
}
header('Location: http://facebook.com/promotionexample') ;
The problem is, when I share the link http://example.com/promotion/?promotion-id=12 to facebook, Facebook processed it and change the link directly to http://facebook.com/promotionexample.
I understand that this is a mechanism to share bit.ly or any other url shortener. But is there any way to avoid it?

Related

Redirect and hide target URL

I want to implement a website which like Youtube, these real URLs of videos has to be hidden.
When a user comes in, and the PHP webpage will authenticate the user, and redirect that user to the real URL of the video. The problem is how can I redirect URL and hide its real video URL, or other ways to prevent the real URL of videos exposed?
I don't know if I got your point, but are you looking for something like this?
$video_url = $user_is_authenticated ? $video_url : $authentication_url."?returnUrl=".$video_url;
echo "<a href='$video_url'>Video Title</a>";
This way, if the user is authenticated, you send him the real video URL, otherwise the login page would be seen instead.
If you don't want users to see the URL you can use session variables during authentication.
You want to hide the video location, I guess. Make a script to feed your video to your front.
feed.php?video=id
This will read your video file based on the video id and return it with propper headers to your frontend player.
URL bar can be hidden using JavaScript in InternetExplorer using window.open method.
And that will work only in InternetExplorer. And remaining browsers dont allow you to hide address bar, as per security issues.

Link to Facebook Fanpage Iframe

I have a problem with my fanpage. A gallery script is running a my webspace and i put it in the app also in th iframe of the Fanpage. The gallery script has get an Share button to post the photos on facebook. This part of it is running fine but when i clicked the link that was posted in Facebook i had been reffered to my page on my webspace and not to the iframe with the webpage and the photo. Is it possible to edit the link to go to this page in facebook iframe?
This is not a problem in general. You can try to redirect your website into the Facebook tab application my checking the HTTP_REFERRER and the url. You might have a look at this example
There is an URL you can try to call and see if you get redirected to the right application. Additionally, you can add app_data-parameters to the URL to identify the real target into your app.
All that can be done by the following code:
// set the target facebook page name and id to perform a forceRedirectToTab()
$tmpFbHelper
->setPageName($iniHandler->getIniSetting('facebook.'.fbHelper::getAppNamespace().'.page.name'))
->setPageId($iniHandler->getIniSetting('facebook.'.fbHelper::getAppNamespace().'.page.id'))
->setSecret($iniHandler->getIniSetting('facebook.'.fbHelper::getAppNamespace().'.secret'));
// perform a redirect to the facebook tab application if someone opens the url out of facebook
// the facebook-linter is not affected by this :)
$tmpFbHelper->forceRedirectToTab();
// perform a deeplink if for example a special url is called or you identify some app-data
$tmpFbHelper->performDeeplink();
You will have to look at your published links into the stream so that the PHP-code finds out that you will redirect and deeplink!
I hope this ideas might help you :)

Does Google bot crawl entire site if there is a redirect

I have a website that redirects a user to the login page after a three page views. Will google bot be able to look at all of my pages or will it be redirected as well. If so, how can I get around this.
I found this answer in a question about googlebot,
if((!$user->uid) || (!strpos($_SERVER['HTTP_USER_AGENT'],"Googlebot")) || (!strpos($_SERVER['HTTP_USER_AGENT'],"MSNBOT")) ){
// redirect
else{
// don't redirect
}
Would this work?
Do not serve up different content to search engines then you do your users. That's called cloaking and is a great way to get banned.
You should use "first page free". It's what sites like Experts Exchange use to allow Google to crawl their restricted content.
Google Bot gets redirected and it will take content from the redirected page into its database as for the original URL.

When creating a facebook tab, how can i check if the user is accessing the page through facebook

I am trying to put a redirect on the iframe page I am creating for a facebook tab to make sure that those accessing the pages outside of FB will be directed to the application.
Everything I have done so far has caused problems with the meta data not being able to be accessed by FB and so on with the redirect causing a conflict.
Does anyone know how to do this?
The best way to know that you are inside a facebook iframe is to check and see if you have been passed a signed_request (and that it is valid).
Here is a link to another SO question that dealt with the same sort of issue.
How to know if my page is running in a facebook iframe or not

Facebook Authentication, IFrame and Variable Passing Help

I am currently using this recently written tutorial on authorizing an application with facebook using auth 2.0 and it works. the application authorizes correctly and uses the GraphAPI.
http://kartiklad.com/oauth-2-0-and-graph-api-for-facebook-canvas-applications/
But the problem is using the IFrame with a multi page website and this method of authentication, each time a different page is called, it has to go back to authentication page which will redirect the user page to the application, which makes it impossible to pass variables using $_GET.
So how would anyone else here suggest passing variables from one page to the next in an iframe?
This is probably not needed by the application I am working on is at : http://apps.facebook.com/prtrackevents/
The problem is that your urls are only navigating within the frame. The authentication of facebook is including your session variables inside a ?session=... query tag on your frame so that when you navigate to a url in your iframe you loose the ?session querystring value so then your app has to re authenticate. The fix is that your links must include target="_top" so that they cause the entire page to change positions. For example, your details link should be like this:
Details

Categories