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".