WebsiteBaker 2.13.8 is now available!
R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WBhttps://forum.websitebaker.org/index.php/topic,32355.0.html
RewriteEngine OnRewriteBase / RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA]
// Check if the config file has been set-upif(!defined('WB_PATH')) { header("Location: install/index.php"); exit(0);}
/* if the get var _route_ is active, then this is a fallback meaning the physical page do not exists */if(isset($_GET['_route_'])) { if(!is_numeric($_GET['_route_'])) { /* takes the url provided as something like /pages/my-page-name.php and change it to what this page would have as "link" = /my-page-name */ $route = mysql_real_escape_string(str_replace(PAGES_DIRECTORY,'','/'.str_replace(PAGE_EXTENSION,'',$_GET['_route_']))); /* this mysql query ask for the link as page or news ONLY */ $demande ='SELECT '.TABLE_PREFIX.'pages.page_id,'.TABLE_PREFIX.'mod_news_posts.section_id, '.TABLE_PREFIX.'mod_news_posts.post_id FROM '.TABLE_PREFIX.'pages LEFT JOIN '.TABLE_PREFIX.'mod_news_posts ON '.TABLE_PREFIX.'pages.page_id = '.TABLE_PREFIX.'mod_news_posts.page_id WHERE '.TABLE_PREFIX.'pages.link LIKE \''.$route.'\' OR '.TABLE_PREFIX.'mod_news_posts.link LIKE \''.$route.'\''; $dbcall = $database->query($demande); if($rep = $dbcall->fetchRow()) { $page_id = $rep['page_id']; // if post_id is not null, than it's a news page, and I populate necessary vars if($rep['post_id'] != 'NULL') { $post_id = $rep['post_id']; $section_id = $rep['section_id']; } } else { /* this is a 404 page */ header('HTTP/1.1 404 NOT FOUND'); /* even if your principal page is shown, the server will give a 404 header so metacrawler like Google will know this page does not exists if you got a pre-arranged 404 page you could : makes a header redirect here : header('Location: my404page.html'); or if it's a WB page, link to the page number like : */ // $page_id = 1; } } else { /* in this section the _route_ var is populated in numeric for, meaning the page was call by number like this index.php?_route_=10 */ $page_id = $_GET['_route_']; }}