How do i specify a url to which to redirect the user after he logs out from facebook?

A Web site that I recently worked on for a client involved tying WordPress together with another CMS including tight login integration. Because of clashes with internal functions, I could not call the WordPress logout function directly from the CMS. Intead, I created a special logout page in the WordPress root which I redirected to from the CMS. Following is the code for that page (logout.php):

<?php

require './wp-load.php';

$current_user = wp_get_current_user();

if ($current_user->ID != 0)
    wp_logout();

wp_redirect("https://wordpress.stackexchange.com/");

exit;

You’ll need to somehow secure this, of course. I did so by checking the referrer to make sure the request was coming from the CMS but this might not always be reliable.