Mod_Rewrite: Insert "/" between variables and values in URL
- by Abs
Hello all,
I am attempting clean useful URLs using mod_rewrite. I am sure this is a common question but I am not so hot with mod_rewrite:
I have this URL: http://mysite.com/user.php?user=fatcatmat&sort=popularv
I want to be able to rewrite it like this:
http://mysite.com/user/user/fatcatmat/sort/popularv
(Is there a way to remove duplicates in a URL?)
I think I have managed to do the removal of the PHP extension.
RewriteRule ^(.*)\$ $1.php [nc]
Is the above correct?
For the separate pages, I would have something like this.
RewriteRule ^/?user(/)?$ user.php
Main Question: Its a bit tedious to do all the above but is there a MEGA rewrite rule that will just place "/" in between variables and their values and remove the .php extension from all pages?
Thank you for any help.