user520351
user520351

Reputation:

Redirecting users to the facebook app

If I have an app on facebook that's pulling the content from http://example.com for instance, is there a way I can stop people visting the example.com site and instead redirect them to the facebook app page?

Upvotes: 2

Views: 230

Answers (4)

Björn Kaiser
Björn Kaiser

Reputation: 9912

Facebook is sending a POST variable called signed_request when the page is opened within a Fan Page Tab or the Canvas page of your App. Simply check if the POST variable is there and redirect to your App's Canvas page if not ;-)

Here you can read a bit how the signed_request is used inside an App.

Upvotes: 1

DMCS
DMCS

Reputation: 31860

Kalvin is close. Props to Kalvin :)

  1. Setup your website to default to index.html
  2. Move the real content of your site from index.html to index-fb.html
  3. In index.html then place either the meta tag for redirection or just javascript for location.href='' script for redirection. The url to redirect to will be in the https://apps.facebook.com/{yourappname} format.
  4. In facebook, update the app settings canvas app url from http://example.com to http://example.com/index-fb.html

Upvotes: 0

Affable Geek
Affable Geek

Reputation: 465

Edit the .htaccess or conf.d file on your Apache web server (or the rewrite rules in IIS) to give a 301 Permenant Redirect.

Assuming you have Apache:

1.) Log into the box using ssh or some terminal emmulation program

2.) cd /etc/httpd/conf.d

3.) Locate the the configuration file for your site, edit it using vi, emacs, nano, or some text editor

4.) See here on how to write the rewrite rule.

Upvotes: 0

Kalvin Lyle
Kalvin Lyle

Reputation: 11

1) Pull your content from your website from a subfolder

2) Redirect them from the index.html using a meta tag: http://www.web-source.net/html_redirect.htm

A better way would be to check if the content is being displayed inside facebook and then redirect but I have no idea how to do that

Upvotes: 0

Related Questions