Sign up ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have a website ( that has another site being built within it (

My client wants to create a new domain name and have it point to the directory that houses the new site.

As a front end dev I am very confused as to how to go about this. Is this something that can be in htaccess? What would I place on the registrars end?

Would anyone know the best way to do this?

share|improve this question

2 Answers 2

Let's assume that

  • your client's new domain is

  • your server's ip address (where you have is

  • the path to newsite on your server is /srv/www/newsite

  • your webserver is Apache

First, you need to create a virtual host in Apache, containing at least:

<VirtualHost *:80>
    DocumentRoot /srv/www/newsite

If you're on Debian based systems, you can just create a new file in /etc/apache/sites-available and put that inside it.

Then run a2ensite and service apache2 reload and you're done.

If you're not on Debian, look on how to add a vhost to your specific distribution apache (CPANEL also has a vhost section for Apache).

Now in your client's registrar, they need to point and to your server's ip address

Additional: as mentioned in the previous reply, you should prevent access to the /newsite dir so people can only access it by the address, and not by To do that, in your vhost, put this

<Directory "/newsite">
  Deny from all

Update the question with more information (include at your OS and webserver and if you have CPANEL or anything similar). The more precise your question is, the more precise the replies you get will be.

share|improve this answer

If you have access to your current hosting setup, you can configure a new virtual host for the domain in your web server.

You would point the root directory of that virtual host to the newsite directory.

Then, you would just enter the IP address of your current web server as the new domain's A records.

You might also want to exclude access to the newsite directory via the old site with .htaccess rules.

share|improve this answer

Your Answer


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.