View Full Version : Domain Masking
12-08-2008, 06:53 AM
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
12-08-2008, 07:18 AM
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?
12-08-2008, 07:36 AM
My hosting is at domain.com
IF I enter chan2008.com I must get the output from test.domain.com
Thanks for your reply
12-08-2008, 09:56 AM
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.