I'm pretty new to this mod_rewrite business but I'd like to have a rule that allows me to accomplish the following:
localhost/module_name/ -> localhost/index.php?module=module_name
localhost/module_name/module_action -> localhost/index.php?module=module_name&action=module_action
localhost/module_name/module_action/parm1 -> localhost/index.php?module=module_name&action=module_action&parm_1=parm1
localhost/module_name/module_action/parm1/parm2 -> localhost/index.php?module=module_name&action=module_action&parm_1=parm1&parm_2=parm2
and so on. I managed to get module_name and module_action to work, but I can't figure out how get it to work with only a module or with multiple parameters. This is what I currently have:
RewriteEngine on
RewriteRule ([a-zA-Z]+)/([a-zA-Z]+) index.php?module=$1&action=$2
RewriteRule ([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z]+)$ index.php?module=$1&action=$2&parm=$3
The first rule seems to work but it breaks apart on the second one.
Any help would be really appreciated.