This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Jump to the post that solved this thread.
subdomain with www is not working !!!!
#1
[Solved] subdomain with www is not working !!!!
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 http://www.subdomain.mysite.com as well.
Reply
Thanks given by:
#2
[Solved] RE: subdomain with www is not working !!!!
There are a few posts related to this somewhere. Yet, Me.B uses cloudflare and may be of more help.
-TGates - Head of Support

SEARCH the Forums or read the DOCUMENTATION before posting!
Modules Maintained: 13 - Module Installs: 108k+

Find my support or modules helpful? Donate HERE
Get your domains using my affiliate link:
GoDaddy - Domains
Reply
Thanks given by:
#3
[Solved] RE: subdomain with www is not working !!!!
@TGates Believe me I have checked out all the posts related to this. But not finding a proper solution. Some posts tells you to do some changes on .htaccess some post tells you to change the config on apache. Some posts tells you to create page rules. Tried with everything I have found. But none is working.

I am thinking if there's any way to add the subdomain with www as an additional subdomain but sentora is not allowing me to do so. So If I can add
Code:
subdomain.mysite.com
and
Code:
www.subdomain.mysite.com
as a separate subdomain then I can just assign the
Code:
www.subdomain.mysite.com
domain path to the
Code:
subdomain.mysite.com
path. So it will be same in any way. I just need a solution that works and that's it.

So @TGates what are the modification that I have to do in Sentora's config files to make it happen?
Reply
Thanks given by:
#4
[Solved] RE: subdomain with www is not working !!!!
(08-07-2018, 08:02 AM)yusha Wrote: @TGates Believe me I have checked out all the posts related to this. But not finding a proper solution. Some posts tells you to do some changes on .htaccess some post tells you to change the config on apache. Some posts tells you to create page rules. Tried with everything I have found. But none is working.

I am thinking if there's any way to add the subdomain with www as an additional subdomain but sentora is not allowing me to do so. So If I can add
Code:
subdomain.mysite.com
and
Code:
www.subdomain.mysite.com
as a separate subdomain then I can just assign the
Code:
www.subdomain.mysite.com
domain path to the
Code:
subdomain.mysite.com
path. So it will be same in any way. I just need a solution that works and that's it.

So @TGates what are the modification that I have to do in Sentora's config files to make it happen?

Add that in the /etc/sentora/configs/apache/httpd-vhosts.conf where you will find the subdomains referenced, and that is the file called by the main apache config. I think you'll need a ServerAlias http://www.your.subdomain.com
I believe you should update your host dns records as well for it to work. I might test it later and confirm.
***********************************************
SAMUEL AVOLA MUNGUJAKISA         *
CEO, Bero Computers                         *
http://www.berocomputers.com          *
+256754086797                           *
+256780585402                     *
*****************************  *
Reply
Thanks given by:
#5
[Solved] RE: subdomain with www is not working !!!!
(08-07-2018, 03:05 PM)mungujakisa Wrote: Add that in the /etc/sentora/configs/apache/httpd-vhosts.conf where you will find the subdomains referenced, and that is the file called by the main apache config. I think you'll need a ServerAlias http://www.your.subdomain.com
I believe you should update your host dns records as well for it to work. I might test it later and confirm.

Yeah I have seen that file. Please Give me step by step method if it works for you
Reply
Thanks given by:
#6
[Solved] RE: subdomain with www is not working !!!!
(08-07-2018, 03:08 PM)yusha Wrote: Yeah I have seen that file. Please Give me step by step method if it works for you

Note: Be careful while editing the vhosts file, this can cause apache to stop working if edited wrongly! Also I'm on Ubuntu, I hope it works on CentOS

You can do this by performing the following steps:
  1. Open /etc/sentora/configs/apache/httpd-vhosts.conf using your favourite editor (I prefer nano). Scroll down till you find the record for your subdomain, which will look like #DOMAIN: sub.domain.com 
  2. Add a new line under the "ServerName" line
    Code:
    ServerAlias www.sub.domain.com


  3. save the file and exit the editor.
  4. Go to your host DNS editor (not the one of Sentora) and add an A record. If your subdomain is sub.domain.com, then the A record should be "sub" (leave quotes out) and point to your public IP address. Your DNS should already have a www entry for your main domain, so you can leave it as it is or add it if missing.
  5. Restart Apache. For me since I'm on ubuntu, I use
    Code:
    service apache2 restart


  6. Test and see if it works. If it doesn't, you may need to clear your cache; for me I tested on another browser instead of clearing my cache and losing temporary files, it works perfectly.
Hope this is clear enough; cheers!
***********************************************
SAMUEL AVOLA MUNGUJAKISA         *
CEO, Bero Computers                         *
http://www.berocomputers.com          *
+256754086797                           *
+256780585402                     *
*****************************  *
Reply
Thanks given by:
#7
[Solved] RE: subdomain with www is not working !!!!
hey Yusha, did this help?
***********************************************
SAMUEL AVOLA MUNGUJAKISA         *
CEO, Bero Computers                         *
http://www.berocomputers.com          *
+256754086797                           *
+256780585402                     *
*****************************  *
Reply
Thanks given by:
#8
[Solved] RE: subdomain with www is not working !!!!
(08-08-2018, 07:48 PM)mungujakisa Wrote: hey Yusha, did this help?

yeah it eventually does but whenever I need to create a domain I need to do a lot of process like adding a record in dns zone editor, changing the vhost config, add the subdomain in sentora panel.

Is there any quick way where I can bypass sentora's message and add www as an additional subdomain in subdomain section of sentora panel?
Reply
Thanks given by:
#9
[Solved] RE: subdomain with www is not working !!!!
(08-10-2018, 03:08 PM)yusha Wrote: yeah it eventually does but whenever I need to create a domain I need to do a lot of process like adding a record in dns zone editor, changing the vhost config, add the subdomain in sentora panel.

Is there any quick way where I can bypass sentora's message and add www as an additional subdomain in subdomain section of sentora panel?

This is just a work-around; I've not seen that option in Sentora yet, and I'm no expert; I think it should be included in the next version of Sentora among other features I'm thinking of.

Have a blessed day.
***********************************************
SAMUEL AVOLA MUNGUJAKISA         *
CEO, Bero Computers                         *
http://www.berocomputers.com          *
+256754086797                           *
+256780585402                     *
*****************************  *
Reply
Thanks given by:
#10
[Solved] RE: subdomain with www is not working !!!!
Quote: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!
Proper Solution -HERE-



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
Code:
www.subdomain.yoursite.com
as an individual subdomain 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.

If you are using cloudflare free plan then you have to unmask the
Code:
www.subdomain A record
by clicking on the orange cloud and making it grey.
Reply
Thanks given by:
Jump to the post that solved this thread.


Possibly Related Threads...
Thread Author Replies Views Last Post
module=ftp_management not working BloodySky 7 269 Yesterday, 06:29 AM
Last Post: TGates
mail() don't working BigBang 3 199 08-13-2018, 08:32 AM
Last Post: wormsunited
redirect all subdomain wonchoe 1 542 02-10-2018, 12:04 AM
Last Post: MrKaKisen

Forum Jump:


Users browsing this thread: 1 Guest(s)