任何人都可以用"domain.com/store1/any-product“代替"store1.domain.com/any-product”吗?第二个是我所拥有的,第一个是我想要的。
也许添加了一些.htaccess代码?还需要别的什么吗?
发布于 2017-08-22 20:11:38
您应该能够通过在.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。
在测试之前,请确保清除缓存。
https://stackoverflow.com/questions/45816211
复制相似问题