How to write .htaccess for following links? Something like home.php/page/about

home.php?page=about
home.php?page=services
home.php?page=events
home.php?page=gallery&id=1 //redirected from home.php?page=events//
home.php?page=contact

home.php

$default = 'default'; 
$page = isset($_GET['page']) ? $_GET['page'] : $default;  
if (!file_exists(''.$page.'.php'))    {
    $page = $default;
} 
include(''.$page.'.php');

e.g
page=about is used to get about.php

include(''.$page.'.php'); this includes **about.php ** for this example

mod_rewrite turns your webserver into a super-server and frees it from the constraints of filenames.
trick is to turn an error page into a search. For example, if someone tries to type in a wrong page say http://yourserver.com/pagethatdoesntexist.html you redirect it w/ mod_rewrite to http://yourserver.com/search.php?query=pagethatdoesntexist so that you come up w/ links to possibly what the user was looking for instead of a ‘page not found’.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.