I'm a newbie to mod_rewrite and I'm wondering if there's in whatever way you can make on rewrite script that handles and quantity of variables you throw in internet marketing.

Example:

www.krisnicolaou.com/index.php?id=5&sort=asc&limit=25&param=first_name

to

www.krisnicolaou.com/5/asc/25/first_name

...but, you may also pass these variables in on another page also it works with that certain script:

www.krisnicolaou.com/index.php?page=view&action=add

to

www.krisnicolaou.com/view/add/

I basically don't wish to be limited regarding the number of parameters I'm able to add onto the finish without having to constantly customize the .htaccess file.

Thanks ahead of time.

Something similar to this.

Usually one wish to take 'clean' web addresses, and covert these to parameters. What you're requesting may be the opposite. Here is a examined ruleset.

RewriteEngine on

RewriteCond %{QUERY_STRING} !^$
RewriteCond %{QUERY_STRING} ^([^=]*)=([^&]*)(&.*)?
RewriteRule ^(.*/)?([^/]+) $1%2/$2?%3 [L]

This can run if you will find parameters, as well as for each param, it'll combine it with the URL and take it out of the param list. The [N] will make it run until you will find forget about parameters.

To check, I produce the following structure:

view
view/add
view/add/index.htm

I place the above rules inside a .htaccess file.

Normal test: http://www.theeggeadventure.com/2009/index.htm?page=view&action=add

Additional params (404) test http://www.theeggeadventure.com/2009/index.htm?page=view&action=add&foo=bar URL /2009/view/add/bar/index.htm wasn't available on this server.