使用此 htaccess 创建子域?
Create a subdomain with this htaccess?
子域在包含此 htaccess 文件的主机上不起作用
此代码文件“.htaccess”:
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .* - [L]
RewriteRule ^(.*)/cgi-bin/(.*?)/ .php?lang= [L,NC,QSA]
我想要如下:
https://example.com/us/cgi-bin/index/到
https://subdomin.example.com/us/cgi-bin/index/
取决于上述文件“.htaccess”。
请帮我解决这个问题
请使用您的域值尝试以下代码
RewriteCond %{ENV:REDIRECT_SUBDOMAIN} =""
RewriteCond %{HTTP_HOST} ^([a-z0-9][-a-z0-9]+)\.domain\.com\.?(:80)?$ [NC]
RewriteCond %{DOCUMENT_ROOT}/%1 -d
RewriteRule ^(.*) %1/ [E=SUBDOMAIN:%1,L]
RewriteRule ^ - [E=SUBDOMAIN:%{ENV:REDIRECT_SUBDOMAIN},L]
子域在包含此 htaccess 文件的主机上不起作用
此代码文件“.htaccess”:
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .* - [L]
RewriteRule ^(.*)/cgi-bin/(.*?)/ .php?lang= [L,NC,QSA]
我想要如下: https://example.com/us/cgi-bin/index/到 https://subdomin.example.com/us/cgi-bin/index/
取决于上述文件“.htaccess”。
请帮我解决这个问题
请使用您的域值尝试以下代码
RewriteCond %{ENV:REDIRECT_SUBDOMAIN} =""
RewriteCond %{HTTP_HOST} ^([a-z0-9][-a-z0-9]+)\.domain\.com\.?(:80)?$ [NC]
RewriteCond %{DOCUMENT_ROOT}/%1 -d
RewriteRule ^(.*) %1/ [E=SUBDOMAIN:%1,L]
RewriteRule ^ - [E=SUBDOMAIN:%{ENV:REDIRECT_SUBDOMAIN},L]