Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 11 of 11

This is a discussion on pointing a sub domain to another sub domain in the VPS & Dedicated forum
Hello, I am on VPS and would like to point www.mysite.com/sub2 to www.mysite.com/sub1 without a redirect. This means that if the user fills in www.mysite.com/sub2 ...

  1. #1
    Loyal Client
    Join Date
    Mar 2010
    Posts
    7

    pointing a sub domain to another sub domain

    Hello,

    I am on VPS and would like to point www.mysite.com/sub2 to www.mysite.com/sub1 without a redirect. This means that if the user fills in www.mysite.com/sub2 he needs to remain on www.mysite.com/sub2 (the user still sees the domain they typed in when they look in their address bar). Just like when you park two domains on top of the other.

    I have tried to use
    HTML Code:
    <? include "http://mysite.com/sub1"; ?>
    but this didn't work.

    I created a new ticket, which was escalated to a level 2 technician to assist me better with the issue.
    However, I was told by the level 2 technician that this type of website customisation is beyond their scope of support.

    I would therefore appreciate any help.
    Thank you.

  2. #2
    JPC CSR
    Join Date
    Aug 2011
    Posts
    93
    Hello,
    There are 2 ways of doing this that I can think of.

    1. Use an iframe that is embeded in your page
    2. Use a .htaccess mod rewrite rule

    I am on my ipad rigjt now, so typing up some code is a bit of a pain, but i will check back on this thread tomortow when I am working and give you some code snippets.

    Regards
    James G
    Customer Service
    JaguarPC

  3. #3
    Ron
    Ron is offline
    Loyal Client
    Join Date
    Aug 2002
    Posts
    7,312
    If there is nothing in sub2 you could simply delete sub2 then point sub2 to sub1 as a link.
    WARNING WARNING WARNING
    I have never tried this, I'd try it first on non-production subdomains. There may be Apache and/or php issues based on the perms of the link... not sure. I might run this by support for their opinion. Although www itself is a symbolic link, so you're probably gonna be ok. But I'm not positive.


    WARNING WARNING WARNING
    The following commands WILL delete everything that exists in sub2 including the directory itself.

    I think the commands would be pretty close to
    Code:
    cd /home/youraccountname/www/
    rm -rf sub2
    ln sub1 sub2
    This creates a symbolic link between the directories. So it follows that working on/uploading/deleting/whatever on any file in either sub1 or sub2 affects the file equally.
    Last edited by Ron; 08-22-2011 at 08:20 PM. Reason: I always get the darn ln arguments backwards
    Good luck

  4. #4
    Ron
    Ron is offline
    Loyal Client
    Join Date
    Aug 2002
    Posts
    7,312
    By the way, you are calling these "subdomains". Did you mean subdomains or just subdirectory?

    If you meant subdomain, this approach should be the same for both
    http://www.mydomain.com/sub1 and http://www.mydomain.com/sub2
    as well as
    http://sub1.mydomain.com/ and http://sub2.mydomain.com/
    Good luck

  5. #5
    Ron
    Ron is offline
    Loyal Client
    Join Date
    Aug 2002
    Posts
    7,312
    Thirdly, this whole approach of yours to serve up the same content on different URLs has the very real possibility to confuse the search engines and/or have them penalize one URL or the other, and it may not be the URL you prefer.

    There is an html meta tag to tell Google et. al. which page is the primary page. But it can be quite dangerous...
    Good luck

  6. #6
    JPC CSR
    Join Date
    Aug 2011
    Posts
    93
    Ron, you are correct in everything you have said above. It would be more helpful to know exactly what application this is required for and of course, if its a subdomain or subdirectory too. You will just end up confusing search engines and visitors for that matter. A 301 redirect is probablly the correct way to do it, however, if you can expand on your application, I can try and help you out there some more.

    Regards
    James G
    Customer Service Rep
    http://www.jaguarpc.com

  7. #7
    Loyal Client
    Join Date
    Mar 2010
    Posts
    7
    Thank you guys for your reply.

    I think I better wait for JPC-JamesG to help me with the .htaccess mod rewrite rule as I wouldn't even know where to type Ron's commands.

    I know google doesn't like duplicate contents but I need it for a different thing.

    I have an e-shop and wanna create a second store. The 2nd store will be managed from the 1st store and both stores will have only one admin section.
    However, the second store will have a different currency, design, logo, template etc.

    I have one store in a sub directory / domain for a testing purposes only (to test new modules, add-ons etc. before I install in on a live store) and need to point the 2nd sub directory / domain to the 1st sub directory / domain.

    When it's all set up and working I will simply park the 2nd domain on top of the 1st one.

  8. #8
    Ron
    Ron is offline
    Loyal Client
    Join Date
    Aug 2002
    Posts
    7,312
    So this is JUST for the admin functions of the store? Sometimes software limitations won't allow this type of thing to work well at all. Other times it might work perfectly.

    Have you checked with the estore's website or community if this can be done this way or if they have any particular suggestions? They/that be the BEST place to get info on how to get something like this working. An analogy might be that you're kind of asking the garage mechanics to tell you the best route to Albuquerque; it might be best to ask the folks who do the mapping software.
    Good luck

  9. #9
    Loyal Client
    Join Date
    Mar 2010
    Posts
    7
    Nope. The shop has nothing to do with it. All I want is to point an empty sub domain to an existing domain, sub domain or site (regardless of the contents of the site)
    It's just like when you park a domain. It doesn't matter what kind of site you are running, It could be a forum, shop etc. and those can be accessed by typing the domain (or any other parked domain name) in the address bar.

  10. #10
    Ron
    Ron is offline
    Loyal Client
    Join Date
    Aug 2002
    Posts
    7,312
    Then you could just create the link as I previously suggested.

    Since I guess you aren't familiar with logging into a shell and issuing arcane unix commands, you can try the following arcane mod_rewrite commands in .htaccess, but I'm not sure it will work in all cases. It definitely will NOT work for sub1.domain.com and sub2.domain.com.

    Code:
    RewriteEngine On
    RewriteRule ^sub2/(.*)$ /sub1/$1
    BTW: This should be in an .htaccess file in the directory just above the two subdirectories.

    The good thing about this is it is non-destructive to anything (except the .htaccess file itself, I suppose). You could get stuff into endless loops, so be prepared to reverse things if they don't work well. Keep backup copies of stuff that works.

    Good luck
    Last edited by Ron; 08-23-2011 at 06:07 PM. Reason: file location added, caveats for subdomain urls added
    Good luck

  11. #11
    JPC CSR
    Join Date
    Aug 2011
    Posts
    93
    Yes, you beat me too it Ron with the .htaccess, thats exactly what I would have done. I kind of understand what you are trying to do there husky, so use Ron's code there and let us know if it works for you.

    Regards
    James G
    Customer Service
    http://www.jaguarpc.com

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •