Setting up a subdomains directory to have a different directory?

They have: 1 posts

Joined: Oct 2006

I know it's simple to set up a subdomain to a directory, eg boards.xxxxx.com go to public_html/boards, but what I'm wondering it if it's possible for you to set up a directory in a subdomain to different directory.

Sort of confusing explanation, but for example, test.xxxxxxxxxx.com/whatever actually redirects to public_html/different-folder

I hope someone can understand what I'm trying to get across, I know I didn't do the best job explaining it Sticking out tongue

Thanks in advance

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

Using Apache on *nix? Let's say you have test.example.com set up as a virtual host with public_html/test as its document root.

The simplest way I can think of is to create a symbolic link in the filesystem called public_html/test/whatever pointing to ../different-folder. If you have shell access you can do it with ln -s ../different-folder whatever while in public_html/test.

Another way is to use Alias and Directory in your VirtualHost config for test.example.com. Add to it something like:

<VirtualHost ...>
...
    Alias "/whatever" "/path/to/public_html/different-folder"
    <Directory "/path/to/public_html/different-folder">
        DirectoryIndex index.html index.php
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
...
</VirtualHost>
'

Smiling

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.