I didn't become happy using Add Store Code to URLs. The main reason was that we couldn't have several store views using the same language (see my question). Besides that I didn't like I have to use a bad store view code just because of the URL.
I did a small test using the frequently recommended "create a subfolder and create symlinks" tip and it may work. Please check if you like it.
- Create a subfolder /ca/
- Inside the subfolder create symbolic links to
- ../app
- ../errors
- ../includes
- ../index.php
- ../js
- ../lib
- ../media
- ../skin
- ../var
- (add other directories if you want/need to)
- edit your vHost config for /ca/ (or copy .htaccess to /ca/ and edit it) to
Set the rewrite base:
RewriteBase /ca/
Initialise the correct store view based on the URL. There are many ways to do it, one may be:
RewriteCond %{REQUEST_URI} ^/ca/.* [NC,OR] RewriteCond %{REQUEST_URI} ^/ca$ [NC] RewriteRule .* - [E=MAGE_RUN_CODE:ca] RewriteCond %{ENV:REDIRECT_MAGE_RUN_CODE} (.+) RewriteRule .* - [E=MAGE_RUN_CODE:%1,E=MAGE_RUN_TYPE:store]`
It worked for me:
- Default store view
- http://test02.magentoshops.vm/ (links from my VM, you won't see anything)
- http://test02.magentoshops.vm/test-category.html
- http://test02.magentoshops.vm/test-category/test-product.html
- Canada store view
Creating folders and symlinks isn't fun but at least you don't have to edit core files.