Sentora Support Forums
subdomain with www is not working !!!! - Printable Version

+- Sentora Support Forums (https://senforums.mach-hosting.com)
+-- Forum: Sentora Forum Archives (https://senforums.mach-hosting.com/forumdisplay.php?fid=5)
+--- Forum: Sentora Public Support Forums v1.0.x (https://senforums.mach-hosting.com/forumdisplay.php?fid=32)
+---- Forum: General Support Forum v1.0.x (https://senforums.mach-hosting.com/forumdisplay.php?fid=36)
+---- Thread: subdomain with www is not working !!!! (/showthread.php?tid=10120)

Pages: 1 2


RE: subdomain with www is not working !!!! - mungujakisa - 08-10-2018

(08-10-2018, 04:41 PM)yusha Wrote: I think we don't have to wait for the next update. I figured it out.

Here's what you have to do. go to

Code:
/etc/sentora/panel/modules/sub_domains/code/
and edit
Code:
controller.ext.php
and just comment out this code with /* */ at line 218
Code:
// Check to make sure the domain is in the correct format before we go any further...        if (strpos($domain, 'www.') === 0) {            self::$error = TRUE;            return FALSE;        }        

Now you'll be able to add www.subdomain.yoursite.com as an individual subdmoain and can create a new directory and redirect that page into the one without www using this code as your index for that newly created directory
Code:
<?php if(!strstr($_SERVER['HTTP_HOST'],'www.')) return; header('HTTP/1.1 301 Moved Permanently'); header('Location: http://'.substr($_SERVER['HTTP_HOST'],4).$_SERVER['REQUEST_URI']); exit(); ?>
or can assign that domain to the existing directory of your subdomain.

Nice, glad you figured it out. I'll be testing it later after I finish my work.
Good day!


RE: subdomain with www is not working !!!! - TGates - 08-11-2018

NOTICE: This fix is not recommended or approved by the Sentora Team. Use at your own risk.

Changing the core code of Sentora is not the proper way to solve this!

There should already be an alias designated in the sub domain's httpd-vhost.conf entry when it is created, similar to:
Code:
# DOMAIN: sub.domain.com <virtualhost *:80> ServerName sub.domain.com ServerAlias  www.sub.domain.com ServerAdmin webmsater@domain.com

Which should be handling the call for www.domain.com. If your DNS is not proper, it will not work.


RE: subdomain with www is not working !!!! - yusha - 08-11-2018

(08-11-2018, 10:35 AM)TGates Wrote: NOTICE: This fix is not recommended or approved by the Sentora Team. Use at your own risk.

Changing the core code of Sentora is not the proper way to solve this!

There should already be an alias designated in the sub domain's httpd-vhost.conf entry when it is created, similar to:
Code:
# DOMAIN: sub.domain.com <virtualhost *:80> ServerName sub.domain.com ServerAlias  www.sub.domain.com ServerAdmin webmsater@domain.com

Which should be handling the call for www.domain.com. If your DNS is not proper, it will not work.

It didn’t added that alies for the subdomains automatically. I tried to add it manually while editing the vhost file. It worked but temporarily. When I ran the deamon it just resets back. So that’s how it worked for me and I am okay with it.


RE: subdomain with www is not working !!!! - TGates - 08-11-2018

(08-06-2018, 05:07 AM)yusha Wrote: Hello guys!

So far all the domains I add are actually working with www but not the subdomians.

I am using cloudflare and when I create a subdomain I always create the subdomain.mysite.com and
Code:
www.subdomain.mysite.com
two A record first in cloudflare and then add the subdomain in sentora panel. 

I have also tried with
Code:
www.subdomain to cname mysite.com
Doesn't works!

Is there any solution for this? I wanted my subdomain.mysite.com to work with www.subdomain.mysite.com as well.

Tested and working with Godaddy DNS and Sentora DNS, not sure for cloudflare:

You must create a CNAME entry for www.subdomain and point it at the main domain (or simply by adding an @)


Something like this:

Code:
Type       Name       Value      TTL CNAME  www.subdomain    @    3600 (1 Hour)

And do not forget! It may take up to 24 hours to become active!