Search code examples
phpparsinghashbang

escaped_fragment request doesnt parse php?


so recently ive rebuilt my site following Google's AJAX Crawling methods.

Everything works fine and an ?_escaped_fragment_= request works fine but i've noticed any php on the page is not parsed and is commented out like so: <!--?php echo $myvar ?-->

Does anyone know why this may be happening?? here is some PHP from my index:

$fragment = $_GET['_escaped_fragment_'];
    $file = '' . (isset($fragment) && $fragment != '' && $fragment != '/' ? preg_replace('/\//', '', $fragment) : 'home') . '.html';
    $re = '/(^<[^>]*>)|(\n|\r\n|\t|\s{2,4})*/';

    $handle = fopen($file, 'r');
    if ($handle != false) {
        $content = preg_replace($re, '', fread($handle, filesize($file)));
        fclose($handle);
    } else {
        $content = 'Page not found!';
        header(php_sapi_name() == 'cgi' ? 'Status: 404' : 'HTTP/1.1 404');
    }

I noticed a regexp in there. Maybe that has something to do with it? I cant fully understand whats going on here, im no expert. Dont exactly want to put my site back up if this is gonna stay like this..

Please lend me a hand here


Solution

  • this was solved by creating a PHP if else statement.