2

I have magento multistore website where store_code is placed after domain name like these below :

http://example.com/code_first/
http://example.com/code_second/

so I want to rewrite store_code url only to be like this :

http://example.com/first/
http://example.com/second/

and I've tried add below code in root magento .htaccess file, but it's still not working :

SetEnvIf Request_URI ^\/first\/ MAGE_RUN_CODE=code_first
SetEnvIf Request_URI ^\/second\/ MAGE_RUN_CODE=code_second

is there any way to rewrite my store_code url ?

  • 1
    Why don't just change the store code in Stores management? – Raul Sanchez Dec 29 '17 at 9:01
  • if I change store code in store management, I worried it will be effected other module since product has been inserted and transaction already running on the website. according to you, it will take effect to other module if it's not, I will change it :) – mrfizh Dec 29 '17 at 9:14
  • 1
    In fact, I've never tried to change it... but I've seen it is possible, so I assume that won't break anything – Raul Sanchez Dec 29 '17 at 9:23
  • Hi @RaulSanchez, Thank you for your answer. I will try to change store code in store management and then testing it to make sure all module running well after change, although I'm still hope to rewrite or masked it via htaccess. :D – mrfizh Dec 29 '17 at 9:40
1

Recently I have gone through the same problem, this worked for me

RewriteCond %{HTTP_HOST} www\.example\.com [NC]
RewriteRule .* - [E=MAGE_RUN_CODE:code_first]
RewriteCond %{HTTP_HOST} www\.example\.com [NC]
RewriteRule .* - [E=MAGE_RUN_TYPE:code_second]
  • Hi @Rahul Singh, it work if I just call www.example.com but when I add with path url with to be this code RewriteCond %{HTTP_HOST} www\.example\.com\/first [NC] it not work, is there any incorrect writing condition url in my httaccess file ? – mrfizh Dec 31 '17 at 11:59
  • try placing the full path url on magento admin directly – Rahul Singh Jan 2 '18 at 4:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.