I'm building an FAQ section. It will have separate sections
SECTION1 Q1 A1
Q2 A2
SECTION2 ...ETC.
I am trying to add some PHP logic that will work with .htaccess rewrite.
The page will have the following logic:
$faq_S = $_GET['section'];
$faq_Q = $_GET['q'];
if (!isset($faq_C)) {
// show all sections
} else {
// show only the section that's set
if (!isset($faq_q)) {
// open the question
} else {
// show all questions in the section
}
}
So, in order to be able to access the page without section and question values I have this:
RewriteRule ^faq|faq/$ pages/faq.inc.php [NC,L]
and I was hoping to add section and question as:
RewriteRule ^faq/([^/]+)/([^/]*)$ pages/faq.inc.php?cat=$1&q=$2 [NC,L]
But it seems that while the first rule works, the second does not. Also I think there might be a better way to have it combined in one. Is there?