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

Now i have domain and subdomain. I want what subdomain show file from domain file. Ex. -> must show file from

How make that with htaccsess thanks

share|improve this question

migrated from Aug 9 '10 at 6:24

This question came from our site for professional and enthusiast programmers.

You can't. You'll need to use virtual hosts in httpd.conf Hopefully someone can post the syntax you'll need. – Rup Aug 8 '10 at 17:03
(-1) Please add more detail to your question. Do you have access to httpd.conf? How and where are your domain and subdomain set up? What kind of redirection do you want? What does the directory structure of your domain and subdomain look like? – Pekka 웃 Aug 8 '10 at 17:03
htaccess is specifically for login credentials or permission based access, not for subdomains or virtual directories. You will have to make another virtual directory tag in your httpd.conf file. – Mike Feb 8 '11 at 7:00

You have to put something like this in httpd.conf. You can't do it in .htaccess.

<VirtualHost *:80>
    DocumentRoot "/Applications/XAMPP/xamppfiles/docs/"
    ErrorLog "logs/"
    CustomLog "logs/" common
share|improve this answer
but hiw to choose the file? i don't know. it;s domain:, and In www. domain i have file ex: subdomain.php. Now need that if user come tu in this domain must show file from Every time must show address In htacsess i know redirect RewriteEngine on RewriteCond %{HTTP_HOST} ^sub.example\.com$ [NC] RewriteRule ^(.*)$ [R=301,L] but problem that he redirect all domain. – Valdas Aug 8 '10 at 17:19
@Valdas how about you answer the questions from my comment. – Pekka 웃 Aug 8 '10 at 20:40

Your Answer


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