domain to web/subfolder - subdomain to web/subfolder

Discussion in 'General' started by corpus, Jan 22, 2011.

  1. corpus

    corpus Member

    [SOLVED] domain to web/subfolder - subdomain to web/subfolder

    Hello to this wonderfull community
    I'd like to have some help with my dns and subdomains records
    first of all sorry for my english

    i have a domain example.com
    i wanted to redirect it to a subfolder of the main web folder
    so the path is web/v4/
    so i went to the Redirect tab and i choose Redirect
    and added the following options
    Redirect type R,L
    Redirect Path /v4

    i also wanted to keep the /v4/ in the url
    so i went to the /etc/apache2/sites-avalaible/ and edit the example.com.vhost produced file
    to look like
    Code:
        
        RewriteEngine on
        #RewriteCond %{HTTP_HOST}   ^example.com [NC]
        #RewriteRule   ^/(.*)$ /v4/$1  [R,L]
        #RewriteCond %{HTTP_HOST}   ^www.example.com [NC]
        #RewriteRule   ^/(.*)$ /v4/$1  [R,L]
        RewriteCond %{HTTP_HOST} ^example.com.$ [OR]
        RewriteRule ^/?$ "http\:\/\/www\.example\.com\/v4" [R=301,L]
        RewriteCond %{HTTP_HOST} ^www.example.com$
        RewriteRule ^/?$ "http\:\/\/www\.example\.com\/v4" [R=301,L]
    
    this worked for me fine so wen i type example.com in address bar always redirects me to example.com/v4/ and web site works fine

    Now
    in the root folder i have some other folders
    and i want to create subdomainns to lead in this folders
    for example subdomain1.example.com to lead in the web/subdomain1 folder
    can someone help me to do this ?
    sould i make some dns records also and what type?

    thank you for your time and plz if you want to help me be as more detailed as you can
    thanks again
     
    Last edited: Jan 25, 2011
  2. falko

    falko Super Moderator Howtoforge Staff

    Yes, you must create DNS records for the subdomains, either A records that point to your web site's IP address, or CNAME records that point to your main domain (example.com).
     
  3. corpus

    corpus Member

    question

    falko thank you for your reply

    Do i have also create a new web site from Sites - Websites - Add new website ? or create a Subdomain for website from Sites - Subdomain for website - Add new subdomain ?

    with a domain subdomain1.example.com
    or it will work only with a A name or CNAME ?

    if i create a DNS A record should i put in the Hostname field subdomain1.example.com. and in the IP-Address the server ip ?

    also for a CNAME record should i put in the Hostname field subdomain1
    and in the Target Hostname example.com. ?

    the procedure

    can someone be more detailed please?
    thanks again
     
  4. falko

    falko Super Moderator Howtoforge Staff

    Yes, you have to somehow create that subdomain, either as a web site of its own or as a subdomain to an existing web site, but that depends on how you want to use the subdomain.

    First you have to find out who controls the nameservers for your domain - if your ISPConfig servers are not authoritative for your domain, then it makes no sense to create DNS records on the ISPConfig server; you must create the records on the authoritative nameservers. You can find them out by running
    Code:
    dig ns example.com
     
  5. corpus

    corpus Member

    What is the difference ? i want to have a subdomain to lead to a folder that it has a new web site (some html files ) and i want to keep
    subdomain1.expample.com in the url. And also make it work with www. in front of it.

    I control the name servers. Ι want to know witch procedure to follow. I have bought the manual but i don't understand completely the procedure to create subdomains.

    Thank you for your patience
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    If you like to have a subdomain which has its own folder for html files, then you create a nwe website and enter "sub.domain.com" in the domain field. The subdomain function is only used to point a domain to a existing website as additional domain. This option is used if you run a cms system in that website which handles the content for multiple domains.
     
  7. corpus

    corpus Member

    Ok i understand this now
    And i have also create a DNS record, right?
    What kind? a CNAME or A record ?
    if it is A name record in hostname field i put
    sub.domain.com. and after the ip
    if it is CNAME i put in hostname
    sub
    and in target hostname
    domain.com. right ?

    the dns record should be created in the same DNS zone of the domain.com zone ?

    thanks again
     
    Last edited: Jan 24, 2011
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    yes.

    Both will work. Personally I prefer to use a a-record.

    yes. Alternatively you can also use:

    host: sub
    ip: ip-address

    as every record can be defined in short form (sub) or long form (sub.domain.com.). The long form ends always with a dot.

    yes.
     
  9. corpus

    corpus Member

    last question i swear :)

    the dns record should be created in the same DNS zone of the domain.com zone ?

    thanks
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes. A dns record always belongs to the zone were its created in.
     
  11. corpus

    corpus Member

    www ?

    i created a new website
    in Domain is subdomain.domain.com
    in Auto-Subdomain is www.
    i also created a A dns record with
    subdomain.domain.com and the ip-address

    everything is fine now
    except one thing

    i can access my site by typing
    subdomain.domain.com
    when i type
    www.subdomain.domain.com
    i got a Server not found in firefox

    * in the DNS zone records allready exists a A record with
    Hostname www
    and the ip-address

    any suggestions ?
    thanks
     
    Last edited: Jan 24, 2011
  12. falko

    falko Super Moderator Howtoforge Staff

    You must create an A record with www.subdomain in the Hostname field.
     
  13. corpus

    corpus Member

    everything works

    everything works fine now
    thanks :)
     

Share This Page