How do I redirect subdomains that do not exist?

后端 未结 2 1436
粉色の甜心
粉色の甜心 2021-01-05 16:52

I am trying to redirect using .htaccess in the following fashion. I am not all that familiar with .htaccess, so I\'m not sure it can be done. Also, I don\'t know if how I am

2条回答
  •  忘掉有多难
    2021-01-05 17:23

    If you want specific subdomains that do not exist, well you'll just have to create them, and then redirect.

    To catch all erroneous subdomains, say I accidentally type metaa.stackoverlow.com, use a wildcard: *.stackoverflow.com. In cpanel, this just involves ticking a checkbox that asks 'make wildcard?' or similar. To edit .htaccess directly, just enter * in place of each specific subdomain.

    Note that this also applies for any directories:

    subdomain.site.com/*

    *.site.com/dir

    *.site.com/*

提交回复
热议问题