0

Now i have domain and subdomain. I want what subdomain show file from domain file. Ex. dom.example.com -> must show file from example.com/subdomain.php

How make that with htaccsess thanks

migrated from stackoverflow.com 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 httpd.apache.org/docs/2.2/vhosts 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
0

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

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "/Applications/XAMPP/xamppfiles/docs/dummy-host.example.com"
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "logs/dummy-host.example.com-error_log"
    CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>
  • but hiw to choose the file? i don't know. it;s domain: www.example.com, and sub-domain.example.com. In www. domain i have file ex: subdomain.php. Now need that if user come tu sub.example.com in this domain must show file from example.com. Every time must show address sub.example.com. In htacsess i know redirect RewriteEngine on RewriteCond %{HTTP_HOST} ^sub.example\.com$ [NC] RewriteRule ^(.*)$ example.com/subdomain.php [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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy