Sub domains not working

Hi
i have just noticed sub domains are not working when going to for example
https://test.domain.com all i get is a blank page with dns cannot be found. checked there is a DNS record and a CNAME has been created.
if i go to https://domain.com/test that works and the site shows.
Any ideas as they where working fine a few days ago
Thank you

Hi bear

I would confirm the nameservers point at your server

If not you need to create the subdomain at the correct dns server

If they do point at your server, clear your computer dns cache and browser cache

Many thanks

John

yes nameservers are pointing to server, seems to be all domains on the server that have sub domains now don’t work.
Bit puzzled as i have not changed any thing.

Hi bear

Have you restarted your server

If you want to pm a subdomain I can check the dns

Many thanks

John

yes restarted server, messaged you the sub domain
thank you

Hi Bear

Your DNS is working and resolving for subdomain but in a browser it is using www.subdomain eg sub.domain.url exists but in browser redirects to www.sub.domain.url and www.sub.domain.url does not exist

I hope that helps

many thanks

John

had a think about this and found the reason with your redirect prompt, thank you John

There had been a htaccess redirect that was redirecting to www.domain.co.uk so its redirecting to a sub of a subdomain.
That of course does not exists in the dns record.

Must admit i didnt think of that at the time, thanks again

just a follow on from this.
Trying to force http to https going from http://domain.com to https://domain.com i can get working but want also http://www.domain.com going to https://domain.com.
Tried a few redirects using htaccess but cannot get the www going to non www working.
Anyone got a working redirect code?
Thank you

Hi bear

Yes but it’ll be a few hours before I’m back and it is put into Apache folder from var

It’ll make more sense when I’m able to post

Many thanks

John

ok, thanks for the reply

Hi Bear

Please see location for the redirect file as below

/chroot/home/siteworx name/var/domain.url/apache

or if not using chroot

/home/siteworx name/var/domain.url/apache

This is the file I named but you call it what you want

SSL-redirect.conf

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Change as you need or require

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://domain.url [L,R=301]

or

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.domain.url [L,R=301]

Once saved or uploaded, restart apache

service httpd restart

Clear your browser cache if it does not redirect

Many thanks

John

That worked lovely, thank you John :grinning:

Just out of interest is there a way for a subdomain to be redirected http://www.subdomain.com to https://subdomain.com
Or am i right in thinking as there is no DNS record for the www.subdomain it would not work? cannot ever remember seeing www in front of a subdomain

Hi bear

Many thanks

Just create the www dns record for subdomain and it would then work

As you say no www dns record means it would not resolve

Many thanks

John

That’s great
Thanks