SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Nov 2002
    Location
    Maryland
    Posts
    307
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Masking a Subdomain

    Hi,

    I need to know how to mask a domain either through .htaccess or through code. I have a website under the subdomain http://sub.domain.com which is working fine. Now I have another domain name www.newdomain.com and I want this to mask my the subdomain URL.So if a user goes to www.newdomain.com, they will see the http://sub.domain.com site, but the address-bar will still show www.newdomain.com. I know I could use a iFrame, but the client wants to www.newdomain.com/about to show the same content as http://sub.domain.com/about.

    I know many of you may respond about the SEO problems this creates, but the client plans to advertise the www.newdomain.com only in print. So hopefully this domain name will never show up in the search engines. People will always see the site as sub.domain.com in Google unless they manually type in www.newdomain.com into the address bar from a magazine.

    I already have the two virtual accounts set up on the server.

    Code:
    /home/newdomain/public_html
    /home/subdomain/public_html
    Any help is greatly appreciated.

  2. #2
    SitePoint Wizard bronze trophy Jeff Mott's Avatar
    Join Date
    Jul 2009
    Posts
    1,278
    Mentioned
    18 Post(s)
    Tagged
    0 Thread(s)
    Sounds like the perfect job for ServerAlias.
    "First make it work. Then make it better."

  3. #3
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,656
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    JeffGSR,

    There are safeguards to protect against what you're describing - hijacking of another webmaster's website. Just remember that, when you change domains (and every subdomain is a separate domain), browsers WILL display the new domain to protect the copyright of the displayed domain. Frames can be made to work as well as AJAXing content which is pulled from subdomain but that's not the wise way to go.

    IMHO, the best solution for you would be to PARK newdomain on the directory of the sub.domain.com - assuming that you own/control/host both domains.

    Yes, ServerAlias may work but ONLY if you have control over the server and/or virtual host file (which most webmasters will never have ... until you get to dedi and, maybe, VPS).

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  4. #4
    SitePoint Member songspk's Avatar
    Join Date
    Feb 2014
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    in shared hosting directory created

    /home/domain/public_html/subdomain/
    if you want to create it on your desire location then it can be don in vps or dedicated server


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
  •