views:

17

answers:

1

Hey guys!

I have a page with a RewriteRule that makes my code: /?p=page will be rewritten like: abc.com/page, but I really want to have more sites under that, and at the moment I have this code in my .htaccess file.

Right now I have the code:

  <IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^(.*)$ index.php?p=$1 [QSA,L]
  </IfModule>

So, instead, I build the page with more pages, such as abc.com/contact/david instead of: abc.com/contact?person=david like I have now ...So how do I do? Guess it is pretty easy, but it would be great if someone wanted to explain it to me.

A: 

I would just have your index.php do it based on the "p" parameter. Your current RewriteRule will work fine for sub-paths. I have successfully used that exact one on a number of sites.

Bryan Ross
In my index.php I have: "echo ($_GET['p'] == '') ? '' : '';if (isset($_GET['p'])) $p = $_GET['p'];else $p = 'p';switch ($p) {//indexcase 'home':include ('home.php');break; ... }"but, If I want a sub-page under home.php, How should I write then?, because it aint working with only write /home/gallery in the url.