问题
I am dealing with a php site, and I want first to remove all the .php extensions for the sites pages, so
www.site.com/index.php
should work with
www.site.com/index
That is already working with this .htaccess configuration, for all the site pages:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
Now I want to make user friendly the site URL with parameters , but my problem is that I can have my site products.php, with multiple params, in multiple orders, and some of them can be optional.
So here are some possibilities of the parameters combination:
www.site.com/products.php?page=1&subCategory=4&category=4
www.site.com/products.php?subCategory=2&category=1
www.site.com/products.php?page=3
www.site.com/products.php?page=3&category=3
So my problem is how to add a rule on .htaccess to transform this into a more user friendly URL like:
www.site.com/products/param-value/param-value/param-value/..
or some URL close to it.
Thanks for your help! I have checked all the topics related to .htaccess and tried the different solutions proposed but I still cannot reach to make this work.
来源:https://stackoverflow.com/questions/37485609/php-htaccess-make-url-user-friendly-for-multiple-and-dynamic-parameters