Hey, I start learning how to use mod_rewrite yesterday and it's really confusing me. This is my file right now:
That deals with these links:
category/card-tricks | categories.php?category=card-tricks
category/money-tricks | categories.php?category=money-tricks
category/street-magic | categories.php?category=street-magic
category/mentalism | categories.php?category=mentalism
The text in bold is gotten from a database. So for example I can go to the admin area and add a new category called "levitation-effects" and in the site navigation a new link will appear pointing to "category/levitation-effects".
When I go to "category/card-tricks" it will $_GET[] the category type which is "card-tricks" and do a query to the database to show all the card tricks. On that page the card tricks will have links like this:
category/card-tricks/card-trick-1 | tricks.php?name=card-trick-1
category/card-tricks/card-trick-2 | tricks.php?name=card-trick-2
category/card-tricks/card-trick-3 | tricks.php?name=card-trick-3
category/card-tricks/card-trick-4 | tricks.php?name=card-trick-4
I want everything to be controlled from the admin area like adding the categories and the tricks but how do I do that without having to change the ".htaccess" file everytime I add a new trick? The answer is probably simple as always. Please help me. Thanks
Code:
RewriteEngine on
RewriteRule ^category/([^/\.]+)/?$ categories.php?category=$1 [L]
That deals with these links:
category/card-tricks | categories.php?category=card-tricks
category/money-tricks | categories.php?category=money-tricks
category/street-magic | categories.php?category=street-magic
category/mentalism | categories.php?category=mentalism
The text in bold is gotten from a database. So for example I can go to the admin area and add a new category called "levitation-effects" and in the site navigation a new link will appear pointing to "category/levitation-effects".
When I go to "category/card-tricks" it will $_GET[] the category type which is "card-tricks" and do a query to the database to show all the card tricks. On that page the card tricks will have links like this:
category/card-tricks/card-trick-1 | tricks.php?name=card-trick-1
category/card-tricks/card-trick-2 | tricks.php?name=card-trick-2
category/card-tricks/card-trick-3 | tricks.php?name=card-trick-3
category/card-tricks/card-trick-4 | tricks.php?name=card-trick-4
I want everything to be controlled from the admin area like adding the categories and the tricks but how do I do that without having to change the ".htaccess" file everytime I add a new trick? The answer is probably simple as always. Please help me. Thanks






