index.php?view=page to dynamic links /index/page/

New to mod_rewrite? This is a good place to start.

index.php?view=page to dynamic links /index/page/

Postby MiLLion » Mon Feb 20, 2006 8:31 am

Hi, I use the following php include script:

Code: Select all
<?

ob_start();
$menu = array ("home" => "includes/home.php", "coding" => "includes/coding.php");
if (isset($_GET["view"])) {
   if (in_array($_GET["view"], array_keys($menu))) {
      require $menu[$_GET["view"]];
   } else {
      print "Error 404.";
   }
} else {
   if (basename($_SERVER["PHP_SELF"]) != "index.php") {
      header ("location: index.php?view=" . array_search(basename($_SERVER["PHP_SELF"]), $menu));
   } else {
      require array_shift($menu);
   }
}

$cnt = ob_get_contents();
ob_end_clean();

print $cnt;

?>


Now my links are index.php?view=page
And i want dynamic links like /index/page/ instead of the other link above. Whats the remodwrite for it? I have tried everything, but it simply wont work!

Petter
MiLLion
 
Posts: 1
Joined: Mon Feb 20, 2006 8:26 am

Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 26 guests

cron