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 ?
asked Dec 29, 2017 at 8:30
mrfizh
1,3632 gold badges14 silver badges30 bronze badges
-
1Why don't just change the store code in Stores management?Raul Sanchez– Raul Sanchez2017年12月29日 09:01:52 +00:00Commented 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– mrfizh2017年12月29日 09:14:00 +00:00Commented Dec 29, 2017 at 9:14
-
1In fact, I've never tried to change it... but I've seen it is possible, so I assume that won't break anythingRaul Sanchez– Raul Sanchez2017年12月29日 09:23:22 +00:00Commented 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. :Dmrfizh– mrfizh2017年12月29日 09:40:47 +00:00Commented Dec 29, 2017 at 9:40
1 Answer 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]
answered Dec 29, 2017 at 11:00
Rahul Singh
1,6702 gold badges20 silver badges40 bronze badges
-
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– mrfizh2017年12月31日 11:59:35 +00:00Commented Dec 31, 2017 at 11:59 -
try placing the full path url on magento admin directlyRahul Singh– Rahul Singh2018年01月02日 04:29:00 +00:00Commented Jan 2, 2018 at 4:29
default