[英]Redirecting to a specific file from all subdomains using htaccess
我想在用戶請求a.domain.com/index.php或b.domain.com/index.php時將流量重定向到特定文件,它會重定向到domain.com/index.php
您可以在DOCUMENT_ROOT/.htaccess
文件中使用此代碼:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^[^.]+\.domain\.com$ [NC]
RewriteRule ^(index\.php)$ http://domain.com/$1 [L,NC,R]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.