This is my first question on this site. Sorry for any errors, etc. I tried to find a similar topic, but found nothing.
Example: .htaccess (only a small part):
RewriteRule ^adm/([a-z]+)/([0-9]+)?/?([a-zA-Z0-9]+)?/?$ index.php?page=adm&page_id=$1&id=$2&act=$3 [NC,L]
This one rule is suitable for several subcategories of the admin panel. As you can see, I have 1 static and 2 optional variables. Static for the switch ($ _ GET [page_id]) on my admin.php. The second variable (optional) for some id (News, Users, Projects or something else). The third variable (also optional) is intended for actions (deletion, editing, prohibition, etc.). So, if I want to check user information, I use this link:
index.php?page=adm&page_id=[users_page]&id=[users_id]
and I do not need action. But if I want to check out some news:
index.php?page=adm&page_id=[news_page]&id=[users_id]&act=[edit]
But sometimes I just need to get into the subcategory:
index.php?page=adm&page_id=[news_page]
And finally ...
Question: It is a good idea to make this rewrite rule universal for several categories of the admin panel, or should I do it separately for each of them. Or are there some other solutions? Remember that some parts of this link are not used. Sometimes I donβt need & act = ... or sometimes I just need only & page_id = ... And there are a lot of such situations. I hope you understand this.
Gedmi source
share