Jul 21, 2009 at 3:55 PM
Edited Jul 21, 2009 at 3:56 PM
Are you saying you want to rewrite this way?
||rewritten (internal) URL
If so, I don't see any rules in your ini file that get anywhere close to doing this. There's nothing that matches on e-store.html, nothing that matches shop.cart, nothing that rewrites to virtuemart.
The way it works is this: you define rules in the ini file that match the incoming (public, SEF) URLs, and then rewrite those URLs to the ugly, internal ones. I don't see anything in the ini file that does anything close to what you're saying you want.
at the very least, you should have something like this:
# Rule 1
# redirect empty URLs to e-store.html
RedirectRule ^/?$ /e-store.html
# Rule 2
# append the option=com_virtuemart&Itemid=26 to every index.php URL that lacks it
RewriteRule ^/index.php(?!option=com_virtuemart)(.*) /index.php?option=com_virtuemart&Itemid=26 [L,QSA]
# Rule 3
# rewrite e-store.html with no params, to the default page
RewriteRule ^/e-store.html$ /index.php?option=com_virtuemart&Itemid=26&vmcchk=1 [L]
# Rule 4
# rewrite the browse page
RewriteRule ^/e-store.html\?page=shop\.browse&category_id=1$ /index.php?page=shop.browse&category_id=1
# Rule 5
# rewrite URLS like e-store.html?page=shop.cart to index.php?page=shop.cart&option=com_virtuemart&Itemid=26
RewriteRule ^/e-store.html\?page=([a-z\.]+)$ /index.php?page=$1
The first one just takes care of empty URLs - you can redirect them to the e-store.html URL. You didn't ask for this, but you might want it. Rule 2 adds the querystring params for any incoming URL that lacks them. Rule 3 rewrites the bare e-store.html URL
. Rule 4 and 5 do the shop.browse and shop.page URLs you mentioned. Actually Rule 5 does a wildcard, so that shop.page matches, but also any character sequence that includes only alpha characters and the dot.
This is just an example to get you started. The above is not the final answer. I suspect there are other pages that need to be rewritten, and aren't covered by the above. I suspect you may want to handle category_id when it is other than 1, but currently
category_id=1 is hardcoded in the rules. ItemId=26 is hardcoded, and that looks suspect. And you probably want other rules to filter out "bad" URLs and send them to a 404 page.
You've also got to test the rules you design with your own URLs. I suggest you check out the testdriver tool for that purpose.
I'm going to offer some additional unsolicited feedback to you. This is intended to be helpful, not critical, and I hope you take it in the right way. Here goes: Based on the questions you are asking me and the information you are providing
to me, I think you need to learn quite a bit more about rewriting in general. For example, you suggest that you want to expose a URL like
/e-store.html?page=shop.cart to the public, and then rewrite it to
/index.php?option=com_virtuemart&Itemid=26&page=shop.cart. But why would you not simplify even further, and expose a cleaner public URL, like
/e-store.html?cart to the public?
And before you deploy a store using this technology, you need to learn more about IIRF in particular. There's no way I would deploy an online store unless I had a clear understanding of the pieces that made it work. You asked me "why doesn't this INI
file work?" But it was obvious to anyone who knows even a little about IIRF that the ini file you gave was not going to work. Not even close.
I think you need to put more thought into this. Read up on IIRF, and on rewriting in general. My sense is that you are just hoping to get a straightforward answer, but I am not able to just give that answer to you. I can tell you about IIRF but you
need to apply it to your environment, or hire an expert who can. I hope I've gotten you started.