.htaccess:基于TLD从文件夹加载
我尝试将功能描述如下: example.com将从webhosting_root/com/加载内容,但URI保持在example.com.htaccess:基于TLD从文件夹加载,.htaccess,redirect,.htaccess,Redirect,我尝试将功能描述如下: example.com将从webhosting_root/com/加载内容,但URI保持在example.com example.es来自webhosting_root/es/,URI:example.es example.pl来自webhosting_root/pl/,URI:example.pl example.cz来自webhosting_root/cz/,URI:example.cz 所有域都设置为路由到一个网络主机 我认为这是可以通过.htaccess规则实现
example.es来自webhosting_root/es/,URI:example.es
example.pl来自webhosting_root/pl/,URI:example.pl
example.cz来自webhosting_root/cz/,URI:example.cz
所有域都设置为路由到一个网络主机 我认为这是可以通过.htaccess规则实现的?但我不知道如何做到这一点。您能帮忙吗?找到了解决方案:
.htaccess
:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?example.com$
RewriteCond %{REQUEST_URI} !^/com/
RewriteRule (.*) /com/$1 [L]
RewriteCond %{HTTP_HOST} ^(www\.)?example.es$
RewriteCond %{REQUEST_URI} !^/es/
RewriteRule (.*) /es/$1 [L]
...