Okay, I have done a fair amount of searching but still can't find something specific enough to handle my problem.
Right now I have a DNS record that redirects all other subdomains to my server. What I'm asking is what would make example.mydomain.com
return HTTP/1.1 301
and redirect to just mydomain.com
My apologies if this has been covered, I just couldn't find anything specific enough.
Select Domain List from the left sidebar and click on the Manage button next to your domain: 3. Find the Redirect Domain section and click on the Add Wildcard Redirect button: 4. Fill in the Destination URL with a link you would like to redirect your subdomain to and check Save Changes: The catch-all feature can be set up for all types of records.
Also, if a separate subdomain is created, it has a higher priority than wildcard. If your domain is pointed to our BasicDNS, PremiumDNS or FreeDNS, this feature is available for you. A wildcard record can be set up for the following record types: A, AAAA, ALIAS, CNAME, TXT, URL Redirect, MX.
Fill in the Destination URL with a link you would like to redirect your subdomain to and check Save Changes: The catch-all feature can be set up for all types of records. In order to select another record type go to the Advanced DNS tab: - Find the Host records section and click on the Add New Record button ( not able to edit Host Records? ):
If you create a separate subdomain, it will take precedence over your wildcard. Catch-all (wildcard) records will only work for A, CNAME, URL redirect, AAA, TXT, and MX record types. They do not work with NS records.
Use a RewriteCond
to match domains other than mydomain.com
and 301 redirect them:
RewriteEngine On
# If the domain (any domain) is not exactly mydomain.com...
RewriteCond %{HTTP_HOST} !^mydomain\.com$ [NC]
RewriteRule (.*) http://mydomain.com/$1 [L,R=301,QSA]
You can also look more specifically for subdomains of mydomain.com
. The one above would match any other domain.
# Match only subdomains of mydomain.com
RewriteCond %{HTTP_HOST} ^(.+)\.mydomain\.com$ [NC]
RewriteRule (.*) http://mydomain.com/$1 [L,R=301,QSA]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With