利用.htaccess限制域名访问

    RewriteEngine On

    RewriteBase /

    #禁止非法域名访问.返回404错误页面.

    #-判断规则,若有多个域名则写多条.(除了以下域名,其他均不允许访问)

    rewritecond %{http_host} !^a.***.com$ [nc]

    rewritecond %{http_host} !^b.***.com$ [nc]

    rewritecond %{http_host} !^***.com$ [nc]

    #-禁止规则

    rewriterule ^.* - [F,L]