three3
three3

Reputation: 2846

Masking a URL with 2 Domains

I am needing help "masking" a url. I have 2 domains but I do not want people to know about what is on my 2nd website. So what I am needing help with is this:

My website is: www.example.com

I have a 2nd website: www.example2.com

When someone clicks on a link that points to www.example2.com, I do not want "www.example2.com" to show in the url bar. I would like for www.example.com to show instead.

Any help is greatly appreciated!

Upvotes: 1

Views: 2253

Answers (2)

Tadeck
Tadeck

Reputation: 137380

Using your example.com page as proxy for example2.com

You can do it in the following way. Treat every request as something you route internally to example2.com site. It can be done using multiple various server-side techniques (eg. HMVC).

Using frames

You can create frame within your example.com page, that will load example2.com page. This is quite unreliable however, because anyone looking into the source can see what your site really loads. Additionally your example2.com page may be secured from this (and will reload itself on the top). They do not even need to look into the source to spot you are using frames. Plus frames are pretty old technique.

Links pointing to example.com that redirect you to example2.com

If you want to have links to example.com that will route users to example2.com instead, you can do this using eg. the following:

jQuery('a[href="http://www.example.com/"]').on('click', function(event){
    event.preventDefault();
    window.location = 'http://www.example2.com/';
});

What it will do is that every link that is pointing exactly to http://www.example.com/ will be redirecting users to http://www.example2.com/, even though it will not be visible in HTML, in status bar or anywhere else. They will see where they are redirected after the redirection happens.

Does it suit your needs? It works exactly as you mentioned.

Upvotes: 2

netadictos
netadictos

Reputation: 7722

only way is to use ajax but it should load in a layer. You could change the urls to example 2 with a custom URL in example.com, where you would get the page you want. You would pass the webpage in example 2 as a parameter to this custom page.

Upvotes: 1

Related Questions