Is there a way to do that when you access an unregistered subdomain redirect you to the main domain?
http://example.example.com/ to http://www.example.com/
Or at least display an error message stating that the subdomain does not exist
Is there a way to do that when you access an unregistered subdomain redirect you to the main domain?
http://example.example.com/ to http://www.example.com/
Or at least display an error message stating that the subdomain does not exist
If this is the case, the by default the url will not load.
When you try to load any unregistred subdomain with your domain, you’ll get an error.(ERR_NAME_NOT_RESOLVED).
ERR_NAME_NOT_RESOLVED Error,
I would like to redirect, and if you can not create a custom error
Something that says “Subdomain not registered, click here to go to the main domain”
I doubt if it is possible,
I’ll check and get back to you.
Something new?
This should be possible by adding this code to your .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+)\.mydomain\.com$ [NC]
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com$ [NC]
RewriteRule ^ http://mydomain.com/suberror [L,R]
And replace mydomain.com with your domain
Doesn’t Work:
ERR_NAME_NOT_RESOLVED
D:
Yes
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+)\.circuitsbm\.com$ [NC]
RewriteCond %{HTTP_HOST} !^www\.circuitsbm\.com$ [NC]
RewriteRule ^ http://circuitsbm.com/suberror [L,R]
Try this
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+)\.circuitsbm\.com$ [NC]
RewriteCond %{HTTP_HOST} !^www\.circuitsbm\.com$ [NC]
RewriteRule ^ http://circuitsbm.com/ [L,R]
///////Didnt works D:///////
I’ll try to find a new code then
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# the following three lines will work for all subdomains
RewriteCond %{HTTP_HOST} !^circuitsbm\.com$ [NC]
RewriteCond %{HTTP_HOST} !^www\.circuitsbm\.com$ [NC]
RewriteRule . "http://www.circuitsbm.com/" [R=301,L]
# the following two lines will redirect non-www to www version of the domain
RewriteCond %{HTTP_HOST} ^circuitsbm\.com$
RewriteRule ^(.*)$ "http://www.circuitdbm.com/$1" [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Dint work, the same error
I think that’ll be impossible then
Sorry for that