I don’t have the time to figure this out completely, but I can tell you this: If you want the category name to be in the rewritten URL, then I am pretty sure that the category name also needs to appear in the original URL. At least, that is the only way I would know how to handle it.
Looking at your rewrite code:
RewriteEngine on
RewriteRule ^helpful_links/(.*)/(.*).php /helpful_links.php?pg=$1&cid=$2
First off, I would delete the forward slash before the word “helpful.” It should look like this:
RewriteEngine on
RewriteRule ^helpful_links/(.*)/(.*).php helpful_links.php?pg=$1&cid=$2
With the above rule, this is what is actually happening….
The first (.*) is $1. The second (.*) is $2. (I think you know that part already.
)
If you want the URL to appear as /helpful_links/2/category-name.php
–then–
In the original URL, where you have cid=$2 — the value of $2 needs to be exactly what you want to show up in the rewritten URL. If you have a number here, then the number will be in the URL. If you have a string-of-words-like-this, then that string of words will be in the rewritten URL.
Examples:
Original URL: /helpful_links.php?pg=6&cid=7
Rewritten URL: /helpful_links/6/7.php
Original URL: /helpful_links.php?pg=2&cid=category-1-here
Rewritten URL: /helpful_links/2/category-1-here.php
Original URL: /helpful_links.php?pg=250&cid=wow-look-at-this
Rewritten URL: /helpful_links/250/wow-look-at-this.php
Hope that makes some sense. :smoker: