Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hopefully someone can help...Server nube setting up new hosting acct

Problem definition:

  • New shared hosting account, want to set up multiple domains / sites on it
  • You have to specify a 'main domain', then set up sub directories to point the other domains at

Required solotion:

  • I don't really want to have all my other sites located in the root of my primary site so want to have all my sites including the primary one in separate sub directories.

So '' actually points to BUT shows up in the users address bar as ''

Also I would like for all requests to '' to just show up as ''

Can anyone advise how to do this - via htaccess maybe?

Also I have had issues with google showing '' as '' is there a way to prevent this.

If I am missing something obvious please forgive me as am a server nube and can not find any answers re this on the site.

Thanks in advance.


share|improve this question
up vote 0 down vote accepted

So, basically, you want to ensure that when a page is requested it is not being accessed from a<subfolder> path, right?

Drop an .htaccess file like the one below in each directory which hosts its own site:

<IfModule mod_rewrite.c>

RewriteEngine On

# force SEPARATE_DOMAIN with www-prefix
RewriteCond %{HTTP_HOST} !^www\.SEPARATE_DOMAIN\.co\.uk$
RewriteRule .*$1 [R=301,QSA]


Replace SEPARATE_DOMAIN with the name of the domain pointed to the directory you're working with and any requests to that directory from the main domain will be permanently redirected to the domain you specify.

Ex: will redirect to

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.