Web Hosting Geeks | Web Hosting Experts
Need help? Call us 1(866)TOP-HOST

14120 reviews 1680 hosting providers

Questions & Answers

Changing the public folder on webserver

Dec 12, 2012 by DinoGuy
Before launching my site I tested it at a free server hosting
I used their directory structure which is like this:
root folder \
public folder \public_html
using this structure I kept all the library files in the root folder and all the public data in \public_html
So my structure was like this:
/include(all  library files)
/logs(log files)
/public_html/index.php
/public_html/home.php
/public_html/ other public files
only public_folder content is  could be accessed via URL
so my URLs were something like this
www.domainname.com/index.php
www.domainname.com/home.php

When I completed the site, I moved it to go daddy.com hosting service, but now I can’t find the same directory permissions I had in my previous free hosting. , All the files are in root folder and are all accessible via URL and so the URL became like this:
 www.mydomain.com/public_html/home.php

I want to redirect the URL requests to  the public_html folder,  to make library file unavailable to the public.
Can anyone please help
Thanks in advanced

1 Answer

0 votes
Dec 12, 2012 by expert
In a  Linux web-server using cPanel,  the home directory is usually /home/username/public_html. If a file is  uploaded to public_html it is accessible directly . So if you upload your files to the directory /home/username/public_html/ , you will have to access it from www.yourdomain.com/public_html/index.php
If you uploaded the files to /home/username/public_html/directory, you need to access it from www.example.com/directory/home.php
Check with your hosting server and move your  files from /home/username/public_html/ to /home/username/public_html .