Author Topic: Change Domain path to subfolder?  (Read 240 times)

0 Members and 1 Guest are viewing this topic.

Offline
**
Change Domain path to subfolder?
« on: December 05, 2025, 09:17:48 PM »
For some reason when you create an account in cwp it does NOT give you that accounts domain listed under, wait for it, "DOMAINS". I am clueless as to why it does not, cpanel and plesk do but anyway, I can NOT see domains under, wait for it, "DOMAINS" in the cwp user panel EITHER. Intentional or just clueless coder who did not include these features??? We will never know.

I need to change the path of the MAIN domain of an account from /home/username/public_html to /home/username/public_html/public for a php script I bought. You canly do this in the cwp user panel for "SUB DOMAINS"...DOH!!!

Anyway, does anyone have an idea on how you can do this? Thx in advance!!!

Offline
**
Re: Change Domain path to subfolder?
« Reply #1 on: December 06, 2025, 01:10:13 AM »
Might seem like a dumb question can't you just update the path that the PHP script points to?

Would be an easy fix and you wouldn't have to mess around with 301 redirects or man handling Virtual Host files
Web Design, Development & Web Hosting
https://6sense.com.au

Offline
**
Re: Change Domain path to subfolder?
« Reply #2 on: December 06, 2025, 01:24:19 AM »
Might seem like a dumb question can't you just update the path that the PHP script points to?

Would be an easy fix and you wouldn't have to mess around with 301 redirects or man handling Virtual Host files

It would most likely require re-writing php code in a lot of files of the script. It's not a selectable or changeable setting available.

Offline
*****
Re: Change Domain path to subfolder?
« Reply #3 on: December 06, 2025, 01:58:18 AM »
Set the desired DocumentRoot in the vhost conf file for your domain. I have to do this for a Drupal site that uses /home/username/public_html/web as the document root.

Offline
**
Re: Change Domain path to subfolder?
« Reply #4 on: December 06, 2025, 05:56:01 AM »
Yep @overseer is on to what I was referring to with the VHosts  ;D

TBH I perfer to keep servers stock as I find it hard to remember what custom mods I've made to each months later.

If you want to update all PHP files within your public folder (obviously not if you've moved the site there already) you can use the below. It should find & replace all 'old_pathway' to 'new_pathway' in all PHP files within the directory you run it in.

Code: [Select]
find . -name "*.php" -exec sed -i 's/old_pathway/new_pathway/g' {} \;
Web Design, Development & Web Hosting
https://6sense.com.au

Offline
**
Re: Change Domain path to subfolder?
« Reply #5 on: December 06, 2025, 09:55:33 PM »
Yep @overseer is on to what I was referring to with the VHosts  ;D

TBH I perfer to keep servers stock as I find it hard to remember what custom mods I've made to each months later.

If you want to update all PHP files within your public folder (obviously not if you've moved the site there already) you can use the below. It should find & replace all 'old_pathway' to 'new_pathway' in all PHP files within the directory you run it in.

Code: [Select]
find . -name "*.php" -exec sed -i 's/old_pathway/new_pathway/g' {} \;

I have done the find and replace on my pc and I went to change the /home/account/public_html/public back to /home/account/public_html but all the domain.com.conf and domain.com.ssl.conf show /home/account/public_html. I cannot find where I did the change at and I have checked conf files under apache and nginx both since I run both. I even looked at the conf files in cli, same thing. Anyway I can find /home/account/public_html/public string in cli without opening hundreds of files to find it?

Offline
*****
Re: Change Domain path to subfolder?
« Reply #6 on: December 06, 2025, 10:22:38 PM »
WebServer Settings  > WebServers Conf Editor Apache > /usr/local/apache/conf.d/vhosts/ > yourdomain.conf
Set the DocumentRoot to:   
Code: [Select]
DocumentRoot /home/username/public_html/public

Offline
**
Re: Change Domain path to subfolder?
« Reply #7 on: December 07, 2025, 11:44:01 PM »
The below will search & list all files for your pathway string in the directory you are currently in

Code: [Select]
grep -r "/home/account/public_html/public" .
Web Design, Development & Web Hosting
https://6sense.com.au