I am trying to build a store site. I want it to have friendly urls such as "/home","/store","/store/5443405", etc. I just cant figure out how to give my url more than one level. i.e. "/home" << one level "/store/5443405" << 2 levels. My php file looks like this right now

include 'includes/functions.php';

$p = isset($_GET['p']) ? $_GET['p'] : 'home';

$page = $p.'.php';

if (file_exists($page)) {
include $page;
else {
print $page;


and my .htaccess:

Options +FollowSymLinks
  RewriteEngine On

  RewriteCond %{SCRIPT_FILENAME} !-d
  RewriteCond %{SCRIPT_FILENAME} !-f

  RewriteRule ^(.*)$ ./index.php?p=$1

Never mind. I figured it out by doing this:

Options +FollowSymLinks
RewriteEngine On

RewriteRule page/(.*) index.php?p=$1 [nc]
RewriteRule products/([0-9]+) index.php?p=products&product=$1 [nc]
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.