htaccess how to make www.subdomain paraller to subdomain?

Discussion in 'Server Operation' started by alva, Aug 17, 2007.

  1. alva

    alva New Member

    Please tell me what code is necessary to write in htaccess file to make

    www.subdomain.domain.com same as subdomain.domain.com

    problem is that my blog system understand only subdomain.domain.com but if user writes www by mistake system shows url error. So I'm sure there must be a code that will make www.xxx.domain.com same as xxx.domain.com for all registered domains.
     
  2. falko

    falko Super Moderator ISPConfig Developer

    You must add
    Code:
    ServerAlias www.subdomain.domain.com
    to the vhost configuration in Apache (not .htaccess). And of course, www.subdomain.domain.com must point to the correct IP address in DNS.
     
  3. alva

    alva New Member

    I want this to be used for all automatically created subdomains not just for one or two. my domain is www.domain.com how to do this?! and at the same time I do not want mistake like www.www.domain.com to be the same as www.domain.com This is the only let's say subdomain that I do not want to be forwarded anywere to allow people go to the main page without problem and register for new blogs.
     
  4. falko

    falko Super Moderator ISPConfig Developer

    You can add as many subdomains to the ServerAlias line as you like, e.g.
    Code:
    ServerAlias sub1.example.com sub2.example.com sub3.example.com
    You'd have to filter that out yourself, e.g. with a script.
     
  5. goitalone

    goitalone New Member

    Need help understanding and configuring home web server virtualhost & subdomains

    I have yet to figure out or understand exactly how to make a top level subdomain work to display something other than my regular website.

    For example:

    I want subdomain.domain.com to display an entirely new site from a different folder, but right now this is the path to ALL of my regular site (forum) content:

    D:/Web/Server/Apache2/htdocs

    I am using my own domain I signed up and paid for up for at www.netfirms.com and forwarded my info to www.freedns.afraid.org to get my domain to work on my webserver from home (at least I think I had to do it that way...still not sure)

    At Netfirms, I can change the A records, CNAME's etc. there but I am not sure if I need to configure anything at Netfirms as well as at freedns.org, or just at freedns.org...(or if I can do it all from Netfirms)

    I don't know exactly what I am doing wrong, but I can't seem to get it to work right.

    I made a domain test subdomain name with A record at freedns (CNAME wouln't work)

    gay.sda-n-friends.com

    I added this to Apache:

    <VirtualHost *:80>
    # ServerAdmin [email protected]
    DocumentRoot /gay
    ServerName gay.sda-n-friends.com
    # ErrorLog logs/dummy-host.example.com-error_log
    # CustomLog logs/dummy-host.example.com-access_log common
    </VirtualHost>

    I made a folder for a new site.

    Tried playing around with .htaccess configurations since that is new to me too and that didn't help.

    Scoured the net looking for an answer, couldn't quite find one that worked for me....nothing worked.

    Can someone please help me figure this out?

    Thanks alot!
     
  6. falko

    falko Super Moderator ISPConfig Developer

    That site is working for me (or should I see different content?).
     
  7. goitalone

    goitalone New Member

    I finally managed to figure it out, thanks!

    I still have to figure out how to use .htaccess commands etc. for, if nothing more, to gain some extra knowledge.

    Can I make subdomain.domain disguised as something else other than ending with my actual domains name?

    Any advice or commands that you could mention of the top of your head that could be useful for .htsccess? I dunno, like maybe explin rewrite a bit to me?
     
  8. falko

    falko Super Moderator ISPConfig Developer

    I think the best is to take a look here: http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
     
  9. goitalone

    goitalone New Member

    Alright cool thanks!
     

Share This Page