简体   繁体   English

如何根据子域(如 wordpress 主题)使用文件更改根文件夹

[英]How change root folder with files according to sub domain like wordpress themes

I have spent days researching the internet and I can not find the answer.我花了几天时间研究互联网,但找不到答案。

I have abc.com website i got sub domain address with the help of .htaccess but How can i show different theme according to subdomain.我有 abc.com 网站,我在 .htaccess 的帮助下获得了子域地址,但是如何根据子域显示不同的主题。

Explanation.解释。 User create sub domain flower.abc.com and vegetable.abc.com etc i get user selected theme the according to sub domain from database php but i can not know how can i change root link and root directory用户创建子域flower.abc.com 和vegetable.abc.com 等我根据数据库php 中的子域获取用户选择的主题,但我不知道如何更改根链接和根目录

directory目录

/index.php  
     //theme folder   
flower/index.php   
....../css/  
...../js/

vegetable/index.php  
....../css/   
...../js/  
etc more theme available

but when user vegetable.abc.com select theme vegetable then show theme vegetable when user select flower theme then show flower theme.但是当用户蔬菜.abc.com 选择主题蔬菜然后显示主题蔬菜时,当用户选择花卉主题然后显示花卉主题时。

vegetable.abc.com/vegetable/index.php  
to   
vegetable.abc.com/index.php

you can use .htaccess你可以使用 .htaccess

vegetable.abc.com/vegetable/index.php   

to

vegetable.abc.com/index.php

Rule in .httaccess file .httaccess 文件中的规则

RewriteEngine On

RewriteCond %{HTTP_HOST} ^vegetable\.abc\.com\/vegetable\/index\.php [NC]
RewriteRule ^$ https://vegetable.abc.com/index.php [R=302,L]

virtual host虚拟主机

<VirtualHost *:80>
    ServerAlias *.example.com
    VirtualDocumentRoot /var/www/%1/
</VirtualHost>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM