且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Opencart多商店"domain.com/aaa"而不是"aaa.domain.com"

更新时间:2022-03-12 22:26:01

您应该能够通过在.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.