Forum Moderators: phranque
i have the following type of URL:
http://www.example.com/area_id,68/simplesearch.htm
i'd like to replace the 'area_id,68' with the "keyterm" associated with 68 and remove the simplesearch.htm at the end of the URL....
so something like this.
http://www.example.com/keyterm.htm
I do have several thousand of these however - can someone please advise a way to do the above without listing the several thousand entries in the .htaccess file?
Is it common to list several thousand entries in a .htaccess file?
many thanks
Marcus
[edited by: jatar_k at 11:51 am (utc) on April 24, 2007]
[edit reason] please use example.com [/edit]
Alternately, your main script (whatever script the URL "simplesearch.htm" currently points to) can do this lookup itself. You just use mod_rewrite or AcceptPathInfo to pass control to your script no matter what the "details" part of the friendly URL contains, and let the script take it from there. For example, you might start all your friendly URLs with "example.com/areas/". The "areas" part of the URL is use to tell mod_rewrite to forward the request directly to the script that does the lookup for the requested "area." The script can then extract anything else it might need from the URL, and then look up the actual data it needs from your database.
If you can't modify the main script, then perhaps you can "wrap" it inside another script, which does only the translation, and then passes the needed info to the original script -- There are a hundred ways to skin this cat.
I cannot recommend putting thousands of rewrites or redirects in an .htaccess file.
Jim