Welcome Guest, Not a member yet? Register   Sign In
.htaccess - Allowing access to sudbdirectories via sobdomains only
#1

[eluser]TheFuzzy0ne[/eluser]
Hi everyone.

I'm hoping that an expert on htaccess files will be able to help me here.

I have my Web root, which has several Web sites in it, each one in a subdirectory. I would like to allow access to the directories, but only via a sub-domain. Example:

Code:
mydomain.tld/         - should resolve the "www" subdirectory.
www.mydomain.tld/     - should resolve the "www" subdirectory.
mydomain.tld/www/     - should give a 404 error, as technically, it doesn't exist.

images.mydomain.tld/  - should resolve the "images" subdirectory.
mydomain.tld/images/  - should give a 404 error, as technically, it doesn't exist.

site1.mydomain.tld/   - should resolve the "site1" subdirectory.
mydomain.tld/site1/   - should give a 404 error, as technically, it doesn't exist.

Hopefully you can see what I'm getting at. Obviously, directories within the sub-domains should be accessible via the URL, just not the subdirectories in my Web root.

I have tried learning Apache directives, but the whole thing has gone over my head. I am going to make more time to learn about them, but for the meantime, I'd really appreciate it if someone could help me with a quick fix. If someone could instead point me to an online article that will show me how to achieve this, I would appreciate just as much. I've spent a lot of time trying to find the answer to my question, and so far, I've gotten nowhere fast.

Many thanks in advance.
#2

[eluser]TheFuzzy0ne[/eluser]
I'm bumping this topic in the hope that someone might be able to point me in the right direction.




Theme © iAndrew 2016 - Forum software by © MyBB