Reputation: 44066
Ok so i am using opencart which is an open source shopping cart. I installed it here the problem is that when you click on anything and I mean anything the url goes from this
http://royaltyfreesoundbank.com/
to
http://royaltyfreesoundbank.com/index.php?route=product/category&path=18
so ultimately what is happening is that
/index.php?route=CONTROLLER/VIEW
which makes sense but the url is ugly and I was wondering if there was a way in htaccess that i can just make all the pages lose this middle portion and have it something like this
http://royaltyfreesoundbank.com/product/category&path=18
ideas anyone....thanks in advance
Upvotes: 0
Views: 362
Reputation: 4180
Here:
# Turn on URL re-writing
RewriteEngine On
# Clean URLs
RewriteRule ^(.+)/(.+)/([0-9]+)/?$ /index.php?route=$1/$2&path=$3 [NC,L]
Then you would access it with urls like:
http://example.com/category/product/354
Note, however, that this is a rather broad rule which will match anyfolder/anyfolder/45 as well as known category/product names, so, you may want to tweak it to limit just to known categories.
Upvotes: 2