Search code examples
cakephpfacebook-appsgoogle-search-console

Webmasters tools "Vendor/channel.php" 404


I use the Facebook plugin (https://github.com/webtechnick/CakePHP-Facebook-Plugin) for CakePHP 2.x. It is works fine. But the "Webmasters tools" is not founds the 'Vendor/channel.php'.

window.fbAsyncInit = function() {
        FB.init({
            appId      : '281854978625137', // App ID
            channelURL : '../../Vendor/channel.php', // Channel File
            status     : true, // check login status
            cookie     : true, // enable cookies to allow the server to access the session
            oauth      : true, // enable OAuth 2.0
            xfbml      : true  // parse XFBML
        });

What is the good channelURL?


Solution

  • Filepaths are not urls

    Only the webroot of a CakePHP application is web accessible - vendor files cannot be accessed by a url.

    A channel file is required by facebook, they also suggest serving it with long cache headers. The plugin you are using provides the same channel.php file as an example.

    To use the channel file copy it into the webroot:

    cd /path/to/app
    cp Plugin/Facebook/Vendor/channel.php webroot/channel.php
    

    And then point at it:

    window.fbAsyncInit = function() {
        FB.init({
            appId      : '281854978625137', // App ID
            channelURL : 'channel.php', // Channel File