Home Trying to mask/alias domains to subfolders, in a way that code in those subfolders can still refer to files in their parent folders
Reply: 0

Trying to mask/alias domains to subfolders, in a way that code in those subfolders can still refer to files in their parent folders

TWNeal
1#
TWNeal Published in 2017-12-07 22:54:18Z

I have three domain names. Let's say first.com, second.com, and third.com. First.com came free with my hosting. Second.com and third.com I got from another provider.

First.com is the main domain associated with my hosting account at Host Gator. And of course, first.com therefore directs me to the default page in {public_html}.

Problem is, my web sites that I want these domains to be attached to are currently located in their own directories...

  • {public_html}/sites/main
  • {public_html}/sites/second
  • {public_html}/sites/third

...in which each site uses a common template from files in its parent directory at {public_html}/sites

As for first.com, not sure how to make my primary domain point to a subfolder instead of {public_html}.

As for second.com and third.com... I'll just set them up as add-on domains, right? Nope, isn't working out, because when accessing one of the subfolder sites from a domain, the client has no way of knowing that a parent folder exists in the server. When I use the double-dots to refer to the parent folder in my code, my browser doesn't know where to look, because as far as the browser is concerned, second.com/ is the top-most directory in the hierarchy.

Was hoping I get around this with domain masking, but it seems cPanel is only allowing me to associate domains with {public_html}/, instead of letting me mask sub-directories. I'm aware there may be a way to do this via .htaccess, but I'm having serious trouble finding a good walkthrough of how to do it, and even then I'm not confident I'll come to better results.

Can anyone offer some advice as to which direction I should go here? Really don't want to have to replace every single double-dot reference, especially since this code needs to be flexible for many different potential web servers.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.334653 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO