Opencart multistore “domain.com/aaa” instead of “aaa.domain.com”

戏子无情 提交于 2019-12-13 03:56:55

问题


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.

Maybe some .htaccess code added? Anything else, please?


回答1:


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]

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.



来源:https://stackoverflow.com/questions/45816211/opencart-multistore-domain-com-aaa-instead-of-aaa-domain-com

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!