Opencart多商店"domain.com/aaa"而不是"aaa.domain.com" [英] Opencart multistore "domain.com/aaa" instead of "aaa.domain.com"
问题描述
任何人都可以帮助拥有"domain.com/store1/any-product"而不是"store1.domain.com/any-product"吗?第二个是我拥有的东西,第一个是我想要拥有的东西.
Anyone can help to have "domain.com/store1/any-product" instead of "store1.domain.com/any-product"? The second is what I have and the first is what I would like to have.
也许添加了一些.htaccess代码?还有其他吗?
Maybe some .htaccess code added? Anything else, please?
推荐答案
您应该能够通过在.htaccess
中使用以下规则来实现这一目标:
You should be able to achieve that by using the following rule in your .htaccess
:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^store1.example.com
RewriteRule ^(.*)$ http://example.com/store1/$1 [L,NC,QSA]
上述操作是如果满足store1.example.com
的条件,则它将URL重写为example.com/store1
.这对于您作为其一部分的任何其他目录也将起作用.因此它将变成example.com/store1/about
.
What the above does is if the condition for store1.example.com
is met, then it will rewrite the URL to example.com/store1
. This will also work for any other directories you have as a part of it. So it would become example.com/store1/about
for example.
请确保在测试之前 清除缓存.
Make sure you clear your cache before you test this.
这篇关于Opencart多商店"domain.com/aaa"而不是"aaa.domain.com"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!