Changing default home directory 'public_html'

Ramon Pego

Active Member
Mar 12, 2019
32
7
8
Brazil
cPanel Access Level
Root Administrator
Hello, I have read some topics here on how to change the root directory of my accounts.
I need it to be just 'public', instead of 'public_html'

I already read a topic that says to change in:
'/var/cpanel/userdata/USERNAME/DOMAIN.COM'
I did but he says after that I need rebuild the:
'/scripts/rebuildhttpdconf'
What do you mean by that?
beacuse did i change, restart apache and updated the browser and still did not change

And I wish everyone would be like this, from now on.

Topic

Thx.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,304
1,252
313
Houston
Hello @Ramon Pego


First of all I want to point out that directory customization such as this is not something that cPanel supports. This means if you have issues with this customization our ability to provide assistance may be limited.

To clarify those instructions you'd need to run the following:

change this to what you need it to say:
Code:
documentroot: /home/USERNAME/public_html
Then run the following commands:

Code:
/scripts/updateuserdomains
/scripts/updateuserdatacache
mv /etc/apache2/conf/httpd.conf{,.bk}
/scripts/rebuildhttpdconf
/scripts/restartsrv_httpd
You should be able to copy/paste those in order to achieve the desired goal.


Thanks!
 
  • Like
Reactions: Ramon Pego

dem

Member
Jun 29, 2020
5
0
1
Philippines
cPanel Access Level
Root Administrator
hi, i tried doing this but upon running the scripts i'm receiving errors

sh /scripts/updateuserdomains
/scripts/updateuserdomains: line 8: use: command not found
/scripts/updateuserdomains: line 9: syntax error near unexpected token `('
/scripts/updateuserdomains: line 9: `use Cpanel::Userdomains::CORE ();
 

Ramon Pego

Active Member
Mar 12, 2019
32
7
8
Brazil
cPanel Access Level
Root Administrator
Hi @dem its probably when you edit your user domain file, you wrote something wrong, or erased some character without seeing

if its possibie show us your domain config file

hide your private info if needed
 

dem

Member
Jun 29, 2020
5
0
1
Philippines
cPanel Access Level
Root Administrator
i really did not change that much, i only modified the documentroot path, below is the config with the domain and username omitted.


---
customlog:
-
format: combined
target: /etc/apache2/logs/domlogs/[domain]
-
format: "\"%{%s}t %I .\\n%{%s}t %O .\""
target: /etc/apache2/logs/domlogs/[domain]-bytes_log
documentroot: /home/[username]/public_html/www/
group: [username]
hascgi: 1
homedir: /home/[username]
ip: [ipaddress]
owner: root
phpopenbasedirprotect: 1
phpversion: ea-php74
port: 8080
scriptalias:
-
path: /home/[username]/public_html/www/cgi-bin
url: /cgi-bin/
serveradmin: [email protected][domain]
serveralias: mail.[domain] www.[domain]
servername: [domain]
usecanonicalname: 'Off'
user: [username]
 

Ramon Pego

Active Member
Mar 12, 2019
32
7
8
Brazil
cPanel Access Level
Root Administrator
it looks like it might be something different, let's wait for someone from the staff to help you.
Do not forget that when it is resolved you must make the change to
Code:
'/var/cpanel/userdata/USERNAME/DOMAIN.COM_SSL'
too
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,304
1,252
313
Houston
hi, i tried doing this but upon running the scripts i'm receiving errors

sh /scripts/updateuserdomains
/scripts/updateuserdomains: line 8: use: command not found
/scripts/updateuserdomains: line 9: syntax error near unexpected token `('
/scripts/updateuserdomains: line 9: `use Cpanel::Userdomains::CORE ();
Why are you running this this way? You shouldn't need to use the sh command to run these. Literally just run:

Code:
/scripts/updateuserdomains
as the root user.
 

dem

Member
Jun 29, 2020
5
0
1
Philippines
cPanel Access Level
Root Administrator
btw, can i also specify a documentindex here? the problem here is my client have 2 domains pointed at the same folder but with each domain having it's own specific index file.