I would use Apache Mod-Rewrite. I even found automatic generators for this but didn't like the result. I just made an imaginary folder, assigned it to be rewritten and used
PHP Code:
$ask=$_SERVER['request_uri']; $array=explode("/",$ask);
to get the vars from my URL for my database query. they're contained in the array called $ask
This is the generic rewrite rule. It matches any charactor found between the brackets.
Code:
Options -indexes
Options +FollowSymLinks
RewriteEngine on
RewriteRule bin/(.*)/(.*)/(.*)$ /$3?section=$1&page=$2
There are better ways to match an expression this is the easiest, also called laziest, way. The parentheses make a group the first group is referred to as 1 the second group is two and etc.
your-site.com/bin/query-value1/query-value2/page.name
is now equivalent too
your-site.com/page.name?section=query-value1&page=query-value2
Have Fun! side note the file in group three must exist in the folder you specify. If you want to use an sub-directory you must use /path/to/folder/$3?section=$1&page=$2 instead of /$3?section=$1&page=$2
__________________
Check out my Please login or register to view this content. Registration is FREE website!
Last edited by Skorch1; 12-16-2005 at 07:32 AM..
|