question about addon domain function

Discussion in 'Site & Server Administration' started by countolaf, May 27, 2009.

  1. #1
    Hi, I have recently used the addon domain function of my hosting account to add a new website of mine... but isn't it that the website could be viewed as a subdomain as well? i mean assuming i have mywebsite.com then added myblog.com as an addon domain... the latter site can be viewed as well in mywebsite.com/myblog right?

    any tips?
     
    countolaf, May 27, 2009 IP
  2. szalinski

    szalinski Peon

    Messages:
    341
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    if i were you i'd block direct access to the subfolder method, just keep it as domain.tld. again, it depends on what you really want to achieve.
    the /subdir is just a side-effect of how addon-domains are created. seems to be some kind of design flaw, but I don't know if there's any danger to exposing anything because of it.
     
    szalinski, May 27, 2009 IP
  3. countolaf

    countolaf Active Member

    Messages:
    662
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #3

    can you be more specific on blocking the subdomain access? I mean how can i actually do it?
     
    countolaf, May 27, 2009 IP
  4. szalinski

    szalinski Peon

    Messages:
    341
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    just use the same rewrite code you'd use for redirecting non-www to www. requests. For example, in your myblog folder, put inside a htaccess there:

    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^myblog.mydomain.tld$ [NC]
    RewriteRule ^(.*)$ http://myblog.mydomain.tld/$1 [L,R=301]
    Code (markup):
    It's the way I do it and it works fine, I'm not a rewrite expert :p
     
    szalinski, May 28, 2009 IP