I am currently using the mod_rewrite rule:
RewriteRule ^(.+)/?$ page.php?slug=$1 [L]
This works fine to make /page
load page.php?slug=page
.
However, I want to URL:
/cat/page
to load
page.php?slug=page
And the URL
/cat
to load the page
cat.php?slug=cat
Is this possible? I could do it on one page.php and use an if to determine which page it should be, however as the code for the category page and the page page is so different, I'd much rather keep them separate.
Thank you,
Sam
Update: More examples, as requested.
/food/pizza
loads page.php?slug=pizza
/food
loads cat.php?slug=pizza
/animals/pigs
loads page.php?slug=pigs
/animals
loads cat.php?slug=animals