Jump to content

Archived

This topic is now archived and is closed to further replies.

peranha

[SOLVED] adding prefix to website

Recommended Posts

I cannot think of what it is called. I want to add a prefix to my website.

 

I want to add test.site.com to my website site.com, but cannot think of how to word it to do a search.  I tried virtual host, but that didnt work as it only set it up to go to http://site/ and http://test/.

Share this post


Link to post
Share on other sites

Subdomain? Your host's control panel probably has a section for managing subdomains.

Share this post


Link to post
Share on other sites

Even if I am hosting on my own server, do I still have to register my domain, or is there something in apache that will do this.

Share this post


Link to post
Share on other sites

A server has an ip address.  You can go directly to your site by entering in the ip address in the address bar.  If you would like to be able to do www.mydomain.com you need to register a domain name and have it point to your server.  Your server/apache/whatever does not do this automatically.  Basically a domain name is a "nickname" for your server. You pay some registrar domain name service money to reroute requests to mydomain.com to your ip. 

 

Now, SUB domains are done on your server.  You would do that in cpanel or wherever. 

Share this post


Link to post
Share on other sites

I am registered with Website website with godaddy, and I am hosting on my own server at my house.  i would like to add test.Website.com.  do I have to register this with godaddy, as well??  I dont have a cpanel installed on my server, so I am woundering if there is another way, or if not, what type of cpanel do you recommend??

Share this post


Link to post
Share on other sites

You can do it without cpanel, but I suggest you download cpanel or something equivalent as it is much easier.  You do not need to register sub domains with godaddy.  You would do it on your own server (through cpanel or on your command line)

Share this post


Link to post
Share on other sites

Try to post the virtual host part of your Apache configuration file.

Share this post


Link to post
Share on other sites
<VirtualHost *:8204>
  DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/mberanek"
  ServerName localhost
</VirtualHost>
<VirtualHost *:8204>
  DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/mberanek/test"
  ServerName test.localhost
</VirtualHost>

Share this post


Link to post
Share on other sites

How doesn't it work? Have you setup your hosts file to make test.localhost go to 127.0.0.1?

Share this post


Link to post
Share on other sites

yes I have, when i go to test.localhost and localhost, they both go to

 

"C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/mberanek"

 

which is localhost.  It will not got to localhost/test when I go to test.localhost not sure why.

Share this post


Link to post
Share on other sites

Did you restart apache after making the changes?

Share this post


Link to post
Share on other sites

yes i did, and to make sure, I restarted the PC after that didnt work.

Share this post


Link to post
Share on other sites

This is my hosts file as well

 

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1       localhost
127.0.0.1	test.localhost

Share this post


Link to post
Share on other sites

It works now, after a couple of more restarts.

 

here is my vhosts file in apache

 


<VirtualHost *:8204>
  DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/mberanek"
  ServerName localhost
</VirtualHost>
<VirtualHost *:8204>
  DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/mberanek/test"
  ServerName test.localhost
</VirtualHost>

 

and this is my hosts file in windows

 

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1       localhost
127.0.0.1	test.localhost

 

Not sure why it didnt work after the first restart, but it finally does.  Thanks

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.