I'm having a helluva time figuring out how to get mod_rewrite to do what I want. Basically, My web app runs completely off of the index.php in the root dir, and acts depending on the string passed to it, for example
www.website.com/index.php?m=user&f=view_profile where
m is the current module being accessed and
f is the current function within that module which is being run. I want mod_rewrite to take that url and format it to
www.website.com/module_name/function_name.html. While this isn't too hard, here is the catch. Each module has a default function, so if no function, f, is specified, then the web app automatically loads the default function for that particular module. In this case, the query string would only specify the module, m. If this happens to be the case, I would like it to display the url as such
www.website.com/module/. It seems to me, this would require some sort of conditional statement within the .htaccess file.
This is all I have so far, which only works if just the module is specified.
Code: Select all
RewriteEngine on
RewriteRule ^([^/]+)/$ index.php?m=$1 [L]
Any help would be greatly appreciated!