Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I'm sure there is documentation for how to do this, but I don't know what it's called so I don't even know how to start searching.

On my webserver, example.com, i have a site called site. It's accessed by going to example.com/site.

I want it instead to be site.example.com.

Can someone point me to apache documentation to enable this?

share|improve this question
add comment

2 Answers

I think you need to use virtual host. Edit the file called .../apache/conf/extra/httpd-vhosts.conf and add this line:

<VirtualHost *:80>
    DocumentRoot "[PATH-TO-APACHE]/Apache2.2/htdocs/tema"
    ServerName site.example.com
</VirtualHost>

Of course you need also to enable virtual hosts on apache editing the httpd.conf file.

share|improve this answer
    
Thanks, do I only need to enable virtual hosts by creating virtual.conf with the content NameVirtualHost * under apache2/conf.d? –  B. VB. Jul 16 '12 at 22:34
    
@B.VB. You can enable it removing the '#' before this line Include conf/extra/httpd-vhosts.conf in the httpd.conf . Anyway you can find a lot of stuff searching for "Enable virtual hosts on [YOUR-OPERATING-SYSTEM]" –  Aurelio De Rosa Jul 17 '12 at 0:10
add comment

Are you sure you want to rewrite or redirect people from the subfolder to a subdomain? Why not create a virtual host / subdomain then do 301 from the old subfolder to the subdomain?

This is a good tutorial on creating subdomains

http://thinkingnectar.com/2008/getting-ubuntu-to-work-creating-subdomain-in-localhost/

share|improve this answer
    
No i don't want to redirect from a subfolder to a subdomain.. In fact I dont want a subdomain at all. I want site.example.com to reference example.com/site (as I plan to have other sites on this host, and don't want to have them all be example.com/site{a, b, c} –  B. VB. Jul 16 '12 at 19:39
    
What do you mean by site.example.com reference example.com/site? Do you mean have them both display the same content? –  Anagio Jul 16 '12 at 20:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.