I agree! I was hoping that my sub-domain could be at the same directory level as public_html, ie with path /home/domain.com/sub-domain.com/ (instead of /home/domain.com/public_html/sub-domain.com/). The current structure is limiting what can be installed on the sub-domain, for that reason I might have to switch control panels.
I started a laravel project in the domain name. I have to specify public_html / project / public path so that I can use it in the main domain. I have a subdomain. It is also included in public_html. I have to map the main domain start folder to the public folder of the laravel project without affecting it.
I did some research and put the pieces together. I found a way. It doesn't tire us. It does not spoil the existing. @usmannasir @CyberPanel @w3services @hennaboy @Alexbruma @NickW
@AnAlien yes path changes can be accomplished using .htaccess rewrite rules and maybe that's a solution for some. However for security I believe it's recommended to locate Laravel application files outside public folders, ie above public_html; Yes the rewrite rule would prevent access, unless .htaccess got deleted.
@hennaboy updating vhost conf would be safer but I've have to do that each time I added a new child-domain.
@Alexbruma sorry for hijacking your post but we seemed to have the same issues.
@usmannasir thank you for the update on github much appreciated! Since mine's a fresh install, I will try applying the updates in files website.html and website.py as shown at https://github.com/usmannasir/cyberpanel/commit/2d891fdd46674ba8a4d6f31b530345104def1457 to my installed files (deleting my existing child domain first).
I can't find an option to delete a child domain, only the main domain, am I missing something? The documents at https://cyberpanel.net/docs/3-creating-and-managing-child-domains/ seem look like they relate to an earlier version.
What I tried on v2.0
- create the subdomain > add domains (with default settings)
- move the previously created folder > file manager > move sub.example.com to /home/example.com
You'll get home/example.com/sub.example.com/
- edit vHost Conf
docRoot /home/example.com/sub.example.com
- Now I have one last problem to resolve - Rewrite rules
cat: /home/example.com/public_html/sub.example.com/.htaccess: No such file or directory
I can't figure where it's defined the .htaccess path
more updates about.
- Litespeed load the correct .htaccess file from the new folder defined in vHost. That's good. Seams that only Cyperpanel in the website management page can't read the new location because in the child domains path it registered the original path from child domain creation.
The path from List Domains:
/home/example.com/public_html/sub.example.com
- Also after we change the docRoot to the new location outside /public_html/
Failed to obtain SSL
Will be interesting to see what would happen when the actual SSL expire and the new one should be obtained.
Comments
I've added this feature in the v2.0.1 branch just now. But this will be the current active dev branch moving forward.
https://github.com/usmannasir/cyberpanel/commit/2d891fdd46674ba8a4d6f31b530345104def1457
You can either install or upgrade to this version when asked for version prompt.
CyberPanel
Blog
It may take 1-2 months, I just created the branch. v2.0.0 just released few days ago.
CyberPanel
Blog
Your HTACCESS file edit;
RewriteEngine On
RewriteBase /your-sub-dir
RewriteCond %{SERVER_PORT} 80
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
RewriteCond %{THE_REQUEST} /your-new-public-file-name/([^\s?]*) [NC]
RewriteRule ^ %1 [L,NE,R=302]
RewriteRule ^(.*)$ your-new-public-file-name/index.php?$1 [L,QSA]
@hennaboy updating vhost conf would be safer but I've have to do that each time I added a new child-domain.
@Alexbruma sorry for hijacking your post but we seemed to have the same issues.
@usmannasir thank you for the update on github much appreciated! Since mine's a fresh install, I will try applying the updates in files website.html and website.py as shown at https://github.com/usmannasir/cyberpanel/commit/2d891fdd46674ba8a4d6f31b530345104def1457 to my installed files (deleting my existing child domain first).
- create the subdomain > add domains (with default settings)
- move the previously created folder > file manager > move sub.example.com to /home/example.com
You'll get home/example.com/sub.example.com/
- edit vHost Conf
docRoot /home/example.com/sub.example.com
- Now I have one last problem to resolve - Rewrite rules
cat: /home/example.com/public_html/sub.example.com/.htaccess: No such file or directory
I can't figure where it's defined the .htaccess path
- Litespeed load the correct .htaccess file from the new folder defined in vHost. That's good. Seams that only Cyperpanel in the website management page can't read the new location because in the child domains path it registered the original path from child domain creation.
The path from List Domains:
/home/example.com/public_html/sub.example.com
- Also after we change the docRoot to the new location outside /public_html/
Failed to obtain SSL
Will be interesting to see what would happen when the actual SSL expire and the new one should be obtained.