subdomains and .htaccess

Discussion in 'Apache' started by joker197cinque, May 26, 2006.

  1. #1
    Hallo guys,

    I uploaded some pages on my website (shared-hosted) and I would lik to add some subdomains.

    My control panel let me add a DNS entry so I did : download.mydomain.com. Pinging it from dos shell works well.

    I noticed that creating this subdomain a folder named "download" is automatically added to root level.

    I'm going to explain my folders structure:

    [root]
    ------>index.html
    ------>page.html
    ------>[download]
    ----------------> index.html
    ----------------> .htaccess

    I'm pretty sure that mod_rewrite is installed and working.

    I would like that browsing my site with this url: download.mydomain.com I actually browse at root level. So, if I call download.mydomain.com/page.html I can browse the one at root page.

    I don't mean redirect but I wish that in user address bar will remain download.mydomain.com.

    In previous configuration, using IIS, I can simply do this.

    Is it possible in Apache? I tried some rewriting script but none of them worked.

    Any help appreciated.

    Best regards.

    Fabri.
     
    joker197cinque, May 26, 2006 IP
  2. infin8

    infin8 Peon

    Messages:
    42
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try this:

    
    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} ^download\.mydomain\.com$ [NC]
    RewriteCond %{REQUEST_URI} !^/download/ [NC]
    RewriteRule ^(.*)?$ /download/$1 [QSA,L]
    
    Code (markup):
     
    infin8, May 26, 2006 IP
  3. joker197cinque

    joker197cinque Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It doesn't work.


    Forbidden
    You don't have permission to access / on this server.

    :-(
     
    joker197cinque, May 29, 2006 IP
  4. infin8

    infin8 Peon

    Messages:
    42
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I assume you replaced mydomain with your actual domain name?
     
    infin8, May 30, 2006 IP