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 ?

4
  • 1
    Why don't just change the store code in Stores management? Commented Dec 29, 2017 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
    Commented Dec 29, 2017 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 Commented Dec 29, 2017 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
    Commented Dec 29, 2017 at 9:40

1 Answer 1

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]
2
  • 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
    Commented Dec 31, 2017 at 11:59
  • try placing the full path url on magento admin directly Commented Jan 2, 2018 at 4:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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