My SEF URLs are working fine on my local machine (WAMP Server) but when i upload it to server (Server API : CGI) it shows all the pages as 404 error. Here is the code i use :
1) .htaccess :
Options -Indexes
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php
2) index.php :
<?php
function display_page($page) {
require_once 'Connections/cnntravels.php';
/* get article */
$sql = "SELECT contentid FROM tblcontents WHERE filename = '$page'";
$res = mysql_query($sql);
/* if not found, display 404 error */
if (@mysql_num_rows($res) == 0) {
require '404.php';
exit;
} else {
$row = mysql_fetch_object($res);
}
$_GET['contentid'] = $row->contentid; // setup query string manually
require 'page.php'; // call the 'real' script
}
/* get requested page */
$dir = dirname($_SERVER['PHP_SELF']);
$page = basename(str_replace($dir, '', $_SERVER['REQUEST_URI']));
/* if empty display the homepage, otherwise display the page */
if (empty($page)) {
require 'home.php';
} else {
display_page($page);
}
?>
Please check my site www.thaitravelguides.com to see the problem and help me out.
Thanks in advance
Bob