Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Domain Masking

  1. #1
    New to the CF scene
    Join Date
    Dec 2008
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Domain Masking

    Hi all,

    I need to know how to mask a domain either through htaccess or through PHP code.

    Say suppose I am having a blog like this http://test.domain.com/ which is working fine. Now I had purchased a domain name chan2008 and I want to mask my blog url through code. like http://chan2008.com which is actually from http://test.domain.com. Any one trying test.domain.com will get the url as http://chan2008.com

    Thanks in advance

    Regards
    chandran

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    So you want to redirect people from test.domain.com to chan2008.com? Where is your hosting? Is it with the chan domain or the domain.com domain? What happens if you type chan2008.com? Will it go to your hosting? Are your name servers setup to go to your hosting account on chan2008.com?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • Users who have thanked _Aerospace_Eng_ for this post:

    chanrohit (12-08-2008)

  • #3
    New to the CF scene
    Join Date
    Dec 2008
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Domain Masking - rel

    My hosting is at domain.com

    IF I enter chan2008.com I must get the output from test.domain.com

    Thanks for your reply

    Regards
    Chandran

  • #4
    Senior Coder
    Join Date
    Oct 2008
    Location
    Long Beach
    Posts
    1,196
    Thanks
    36
    Thanked 164 Times in 164 Posts
    You can't do what you want directly, otherwise I could pose as google.com.

    However, there are a few sloppy ajax hacks that come to mind...

    1) Iframes. You can place a control page on chan2008.com that is empty except for your header and an iframe. That iframe will have width and height set to 100% with a border of 0 so that it doesn't appear to be an iframe. You can then navigate at will within that iframe. By all appearances, you'll have accomplished your goal of "domain masking." Upside: super easy to implement. Downside: wreaks havoc with your SEO (it'll actually be nonexistant beyond a few irrelevant meta tags or hidden keywords in your control page).

    2) XMLHttpRequest. You can create a server-side page (PHP/ASP/JSP) that ajaxes any given POSTed url of test.domain.com's and writes it out on the page. You then have to write a function that parses through ALL the urls on the page (ie "src=","href=" and "url()") and adds your API's page in front of it (if this is hard to understand, let me know I can show you an example). Upside: super SEO friendly - chan2008.com's pages will appear to search engines to be identical to test.domain.com's pages. Downside: tricky to implement.

    If you want an example of option 2), check out this thread: http://codingforums.com/showthread.php?t=152059
    In particular, check out the php code in post #30.

    Despite my above post, I would actually recommend you place a temporary redirect while you spend time migrating one site over to the other. It's better ultimately for SEO.
    Last edited by itsallkizza; 12-08-2008 at 08:58 AM.
    Feel free to e-mail me if I forget to respond ;)
    ohsosexybrit@gmail.com


  •  

    Posting Permissions

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