Jump to content

How to make a subdomain treat a specific path or folder as its root...

- - - - -

  • Please log in to reply
4 replies to this topic

#1
shackrock

shackrock

    Learning Programmer

  • Members
  • PipPipPip
  • 66 posts
I'm trying to figure out how to make a subdomain treat a specific folder or path on my server as its root...
I have Apache/CentOS, WHM and CPanel... help would be appreciated.
Thanks!

#2
Roger

Roger

    If nothing goes right, go left.

  • Administrators
  • 718 posts
  • Programming Language:C, PHP
  • Learning:Python
You should be able to do this in Apache config.
Are you trying to do this for only one subdomain? Or do you want to do it dynamically for multiple subdomains?

For one sub-domain:

<VirtualHost *>

ServerName subdomain.domain.com

DocumentRoot /home/httpd/htdocs/subdomain/

</VirtualHost>

Check out our update Guidelines/FAQ. When posting code, remember to use code tags - Posted Image.

#3
shackrock

shackrock

    Learning Programmer

  • Members
  • PipPipPip
  • 66 posts

Roger said:

You should be able to do this in Apache config.
Are you trying to do this for only one subdomain? Or do you want to do it dynamically for multiple subdomains?

For one sub-domain:

<VirtualHost *>
ServerName subdomain.domain.com
DocumentRoot /home/httpd/htdocs/subdomain/
</VirtualHost>

Just a single sub domain... the problem is i'm not great with Apache at all... is there a way to do this within WHM? Or, perhaps there is a more detailed guide about where that text goes? haha. Further, how do I need to set up the DNS once I do that for a subdomain? I think you catch my drift - I'm a newbie at this...

#4
Roger

Roger

    If nothing goes right, go left.

  • Administrators
  • 718 posts
  • Programming Language:C, PHP
  • Learning:Python
Yes, you can set this up in CPanel: cPanel Domains
Check out our update Guidelines/FAQ. When posting code, remember to use code tags - Posted Image.

#5
shackrock

shackrock

    Learning Programmer

  • Members
  • PipPipPip
  • 66 posts
Sorry I double posted this... I thought the other one didn't get posted. Thanks all, I'm up and running just about fully.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users