Okay, so I have several websites hosted on the same domain. Let's say my main domain name is news.com and my other website is amazon.com. How can I prevent amazon.com showing up as part of news.com? For some reason amazon.com is found on news.com like : news.com/amazon.com To get the website up of amazon.com I have to put it in public html folder of news.com, so I'm guessing that's why. But how do I prevent it from actually being accessible there from news.com? I don't want it showing up on google as news.com/amazon or even to be accessible there. I hope this makes sense. To summarize, how do i prevent news.com/amazon and instead just have amazon.com
You would need a directory-level override with .htaccess to deny the existence of a REQUEST_URI matching ^\/amazon\.com\/?.*? or such, and RewriteRule to [F]. You could also relocate the addon domain outside of the DocumentRoot, so that it's not accessible via the parent domain.
To be more concise, you can, for example, move the addon domain folder outside of public_html, e.g. /home/cpanelusername/amazon.com/, and get your hosting company to update the userdata mapping, and rebuild httpd.conf for you. Or, re-map it inside of cPanel > Addon Domains if it's not restricted to public_html only in WHM. In this way, you could not get to http://news.com/amazon.com because amazon.com/ would no longer exist under public_html where news.com is mapped to. You would then need to update any respective paths in your app to remove /public_html.
@zacharooni much thanks for the quick response! I am a bit of a novice when it comes to the management through ftp and cpanel. So how would I rebuild the addon domains? Essentially the second website (amazon.com) which I am trying to get by itself, is just a single page website, so it doesn't have any other pages within it, so it should be relatively easy? edit: oh, do you mean "Document Root"? Just update that to home/amazon?
Yeah, if it's just a few files, just move the directory, via FTP, out from /home/user/public_html/ into /home/user/ so that your folder resolves to /home/user/amazon.com, then go to cPanel > Addon Domains, and enter the new path for amazon.com so cPanel rebuilds the Apache configuration.