[英]Point all subdomains to root domain on wordpress website (htaccess)
I have a WordPress website, lets say, on http://domain.com . 我可以在http://domain.com上拥有一个WordPress网站。
I want to redirect all possible subdomains of the website to main website through htaccess. 我想通过htaccess将网站的所有可能子域重定向到主网站。
Example abcde.domain.com to domain.com 示例abcde.domain.com到domain.com
Thanks! 谢谢!
Add this to the top of the htaccess file in your document root: 将其添加到文档根目录中htaccess文件的顶部:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com$ [NC]
RewriteRule ^ http://domain.com/ [L,R]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.