php SEO urls通过关键字和mysql查询重写

First, in .htaccess file i put this lines

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z]+)?$ index.php?key=$1 [L]

I got also table in MySQL

| aliasID |     query     | keyword |
--------------------------------------
|    1    | site=articles | articles |

Now in index.php i got

    if(isset($_GET['key'])) $key = $_GET['key'];
    else $key = '';

    if($key) 
    { 

        $invalide = array('\\','/','/\/',':','.');
        $key = str_replace($invalide,' ',$key);

        $checkiskey=mysql_fetch_array(safe_query("SELECT * FROM seoaliasy WHERE keyword='".$key."'"));

        if($checkiskey) {

            // here missing code

        } else { echo '404'; }

    } else {

    echo 'main page';

    }

Now i want to know what code i need to put in "//here missing code" place that include content of page called from MySQL query of MySQL column.

The properly address of site is www.example.com/index.php?site=articles (if this was entered in address bar of internet browser the page was appears corectly)... but i need that the same page must be included after if in address bar i put http://www.example.com/articles (so query [site=articles] from correctly address was converted to key from [keyword] column in MySQL)

Simple, i looking solution for simple SEO URL rewriting based on MySQL table with "queries" and "keywords".

I am not sure from where you want to access the data. However You can call content of any page in PHP by using CURL

    $ch = curl_init("YOUR_PAGE_URL");
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $output = curl_exec($ch);       
    curl_close($ch);
    echo $output;