• How to create a redirect from any subdomain to the main domain?

    • views 1248

    Good afternoon. I want to make a redirect from my now nonexistent subdomains (such as lalala.site.com or 1234.site.com) to the main domain site.com

    Solutions (1)
    1.Add an A record to the DNS records of the domain, for example * .example.com. A Where example.com is your domain, is the IP address to which your domain refers. If this option is not available in the hosting panel, contact your hosting tech support with the problem.  2. In the .htaccess file that should be in the site directory, register RewriteEngine On RewriteCond% {HTTP_HOST}!^Example\.com$ RewriteRule^(. *)$ Http://example.com/$1 Where example.com is your domain.
    Answers (1)
    The whole code will be displayed on one line, it will not be easy to read. In Apache, the .htaccess file: RewriteEngine On RewriteCond% {HTTP_HOST}^(. +)\.Site\.com$ RewriteRule ^ http://site.com/
We do our best for you!
Rate the article
Tell the world about it

Users (0) 0 of 5

  • In order to provide you with the best online experience this website uses personal data (cookies, IP, email, photo, name, website, etc). By using our website, you agree to our use of your personal data. More info we get commissions from the hostings, but our ratings are honest and the reviews are real.

  • Rewards for reviews