One of the websites I built recently has the following folder setup:
- /home/<username>/pubilc_html for all the "desktop" website files
- /home/<username>/mobile for all the "mobile" website files which is located outside the public_html folder
Using this type of folder structure makes it easier for me to organize the different type of sites (mobile/desktop) into their correct areas. However the web hosting company have their setup different to what I would prefer which I will have to accept but it comes with a problem.
I will be having files which contain login scripts and other shared scripts such as CSS & JS scripts in a shared folder within the public_html folder which is fine, but i want to be able to block all access to the shared from the outside world, plus I only want the mobile website only accessible from mobile.exampledomain.com and not exampledomain.com/mobile this might make it easier to explain.
Shared scripts folder:
I only want the web server (i.e localhost) to access shared.exampledomain.com block access to every incoming connection (i.e visitor). for example (the only way I know how)
IF localhost THEN
allow access to shared.exampledomain.comELSE
deny access to shared.exampledomain.comEND IF
Slightly different from the shared scripts. I only want the mobile version of the website accessible from mobile.exampledomain.com and not exampledomain.com/mobile because of URL lengths. For example
BLOCK ACCESS to exampledomain.com/mobile
ALLOW ACCESS to mobile.exampledomain.com
I am hoping this is easier explanation