Php 将virtualsubdomain重定向到与参数具有相同域的页面
在php代码中,我需要将所有虚拟子域重定向到具有相同子域作为参数的页面 例如,重定向自:Php 将virtualsubdomain重定向到与参数具有相同域的页面,php,.htaccess,Php,.htaccess,在php代码中,我需要将所有虚拟子域重定向到具有相同子域作为参数的页面 例如,重定向自: anytext.mydomain.com 致: 如何使用htaccess文件执行此操作?试试看,它肯定会对您有所帮助: # .htaccess Options +FollowSymLinks RewriteBase / RewriteCond %{HTTP_HOST} !^www.your-domain-name.com [NC] RewriteCond %{HTTP_HOST} ^(www.)?([
anytext.mydomain.com
致:
如何使用htaccess文件执行此操作?试试看,它肯定会对您有所帮助:
# .htaccess
Options +FollowSymLinks
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.your-domain-name.com [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([^.]+).your-domain-name.com$ [NC]
RewriteRule ^([^.]+)$ /some_file.php/$1?subdomain=%2 [L,QSA]
你能发布你在htaccess文件中使用的具体内容吗?似乎还有其他问题。
# .htaccess
Options +FollowSymLinks
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.your-domain-name.com [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([^.]+).your-domain-name.com$ [NC]
RewriteRule ^([^.]+)$ /some_file.php/$1?subdomain=%2 [L,QSA]