So, I found this example where I was able to sucessfully move my main domain from the public_html directory to it's own directory within public_html. Now, I have a few more domains that I use as aliases for the domain, but my host doesn't offer masking in the cPanel. So, I thought that I could use this .httaccess to also accomplish the same thing.
So, I have DomainA.com is the main domain, and all the files for DomainA.com were located in the public_html/ directory. So, with this addition to my .htaccess file in the public_html/ directory I was able to move all my files for public_html/ directory to public_html/DomainA.com directory.
------------------------------------------------------------------
# .htaccess main domain to subdirectory redirect
# Do not change this line.
RewriteEngine on
# Change example.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?DomainA.com$
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/DomainA.com/
# Don't change the following two lines.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /DomainA.com/$1
# Change example.com to be your main domain again.
# Change 'subdirectory' to be the directory you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?DomainA.com$
RewriteRule ^(/)?$ DomainA.com/index.html [L]
------------------------------------------------------------------
So, I have DomainB.com Directory/ DomainC.com Directory/ DomainD.com Directory/ DomainE.com Directory located in the public_html/ directory that I would also like to use the files from public_html/DomainA.com/ but when I edit the .htaccess file to B,C,D, or E Domains I get a Forbidden error.
EXAMPLE: DomainB.com
# .htaccess main domain to subdirectory redirect
# Do not change this line.
RewriteEngine on
# Change example.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?DomainB.com$
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/DomainA.com/
# Don't change the following two lines.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /DomainA.com/$1
# Change example.com to be your main domain again.
# Change 'subdirectory' to be the directory you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?DomainB.com$
RewriteRule ^(/)?$ DomainA.com/index.html [L]
Thank you in advance for any reply to assist me with this problem.
So, I have DomainA.com is the main domain, and all the files for DomainA.com were located in the public_html/ directory. So, with this addition to my .htaccess file in the public_html/ directory I was able to move all my files for public_html/ directory to public_html/DomainA.com directory.
------------------------------------------------------------------
# .htaccess main domain to subdirectory redirect
# Do not change this line.
RewriteEngine on
# Change example.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?DomainA.com$
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/DomainA.com/
# Don't change the following two lines.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /DomainA.com/$1
# Change example.com to be your main domain again.
# Change 'subdirectory' to be the directory you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?DomainA.com$
RewriteRule ^(/)?$ DomainA.com/index.html [L]
------------------------------------------------------------------
So, I have DomainB.com Directory/ DomainC.com Directory/ DomainD.com Directory/ DomainE.com Directory located in the public_html/ directory that I would also like to use the files from public_html/DomainA.com/ but when I edit the .htaccess file to B,C,D, or E Domains I get a Forbidden error.
EXAMPLE: DomainB.com
# .htaccess main domain to subdirectory redirect
# Do not change this line.
RewriteEngine on
# Change example.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?DomainB.com$
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/DomainA.com/
# Don't change the following two lines.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /DomainA.com/$1
# Change example.com to be your main domain again.
# Change 'subdirectory' to be the directory you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?DomainB.com$
RewriteRule ^(/)?$ DomainA.com/index.html [L]
Thank you in advance for any reply to assist me with this problem.