1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Create a subdomain for an addon domain

Discussion in 'Site & Server Administration' started by |Norman|, Oct 9, 2015.

  1. #1
    I have my hosting for site.com (public_html).
    On my hosting I have also site2.com which is in public_html/site2.

    I want to create subdomain.site2.com that has the content of public_html/site2/subdomain.

    How can I do this? When someone visit site2.com/subdomain he should be redirected (301) to subdomain.site2.com.

    Some help? :)
    Thank you in advance for any reply!
     
    |Norman|, Oct 9, 2015 IP
  2. Zoti Media Group

    Zoti Media Group Notable Member

    Messages:
    1,598
    Likes Received:
    113
    Best Answers:
    2
    Trophy Points:
    265
    Digital Goods:
    2
    #2
    Create a subdomain site.site.com and create a redirect via .htaccess.
     
    Zoti Media Group, Oct 9, 2015 IP
  3. |Norman|

    |Norman| Member

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    46
    #3
    And what should I insert into my .htaccess?
     
    |Norman|, Oct 9, 2015 IP
  4. Zoti Media Group

    Zoti Media Group Notable Member

    Messages:
    1,598
    Likes Received:
    113
    Best Answers:
    2
    Trophy Points:
    265
    Digital Goods:
    2
    #4
    Try this one.

    RewriteEngine On
    Options +FollowSymLinks
    RewriteBase /
    
    RewriteCond %{http_host} ^site.com [nc]
    RewriteRule ^(.*)$ http://www.site.com/$1 [L,R=301]
    
    RedirectMatch 301 ^/subfolder/(.*)$ http://subdomain.site.com/$1
    Code (markup):
     
    Zoti Media Group, Oct 9, 2015 IP
  5. |Norman|

    |Norman| Member

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    46
    #5
    Ok, I added this line:
    
    RedirectMatch 301 ^/subfolder/(.*)$ http://subdomain.site.com/$1
    Code (markup):

    ... to public_html/site2.

    and now it works. When I go to site2.com/subdomain/ I get redirected to subdomain.site2.com. Great!

    The problem now is that it doesn't load anything! I have a software that should start the install process when I visit the page, but nothing. Error loading the page. Maybe I should see if something is wrong in cPanel?
     
    Last edited: Oct 9, 2015
    |Norman|, Oct 9, 2015 IP
  6. Zoti Media Group

    Zoti Media Group Notable Member

    Messages:
    1,598
    Likes Received:
    113
    Best Answers:
    2
    Trophy Points:
    265
    Digital Goods:
    2
    #6
    Then point the subdomin to a subfolder where the script is installed.
     
    Zoti Media Group, Oct 9, 2015 IP