[英]redirect virtualsubdomain to a page with same domain as parameter
在PHP代碼中,我需要將所有虛擬子域重定向到具有相同子域作為參數的頁面。
例如,從重定向:
anytext.mydomain.com
至 :
mydomain.com/example.php?text="anytext"
我該如何使用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]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.