0

Our company has multiple websites.Lets assume website 1 is demo.com and website 2 is example.com.

I wanted to add a link to demo.com to redirect me to example.com, but by keeping the URL of demo.com. So for instance, i need to display contents of example.com to demo.com/linkedwebsite. So instead of redirecting the link demo.com/linkedwebsite to example.com, i need to display the contents of example.com on demo.com/linkedwebsite?

I dont want to copy and paste the code, i would rather want to redirect automatically.

How can this be done? I just need a direction to get me started. We use codeigniter framework for our website.

I dont want to use IFRAME as example.com exists within our network only, so a client will only see a blank frame as they wont be able to access that information. Also we cannot use cURL as an option because the example.com website works on Java applet. So that wouldnt solve this issue.

Sparky
  • 98,165
  • 25
  • 199
  • 285
Ammar Surti
  • 37
  • 1
  • 11
  • have you tried host masking instead ? – Leo Jun 09 '17 at 15:58
  • No i have't. this is the first time i am hearing this. will have to do some research and see if that would work. – Ammar Surti Jun 09 '17 at 15:59
  • 1
    This is not a PHP question. In **demo.com/linkedwebsite**, put an iframe that loads **example.com** – Chris Lam Jun 09 '17 at 15:59
  • yes its not a php question tho; or try URL Redirects.on your cPanel. – Leo Jun 09 '17 at 16:00
  • I updated my question: iframe cannot be used. – Ammar Surti Jun 09 '17 at 16:02
  • The website is designed using php. so wondered that would be the right way. As mentioned the Example.com website exists on our internal network only and not accessible as global. So i wont be able to use Redirects on cPanel. – Ammar Surti Jun 09 '17 at 16:02
  • You could probably use cURL or `file_get_contents()` if it lets you or a DOM. Edit: Yet seeing another question of yours https://stackoverflow.com/q/44412620/ doesn't seem to be an option. – Funk Forty Niner Jun 09 '17 at 16:09
  • Thank you Fred. I tried using cURL. But example.com operates on Java applet. and cURL doesnt seem to like it. So that doesnt solve my problem either. EDIT: Yes i am trying to rephrase my question just so that i could find a solution to this. – Ammar Surti Jun 09 '17 at 16:11
  • to which I edited my comment above before yours ;-) I think you should edit your question about the JAVA and include as much information as possible. @AmmarSurti – Funk Forty Niner Jun 09 '17 at 16:12
  • I just did what you said an edited the question. Thank you – Ammar Surti Jun 09 '17 at 16:14
  • @AmmarSurti welcome. I added the "java" tag since I thought it is relevant. If you wish to "ping" someone in particular, you will need to use the `@username` as I did for you here. Others may not still be present in the question. I for one will not be able to help you with this, not with the java. – Funk Forty Niner Jun 09 '17 at 16:16
  • @AmmarSurti Have a look at these https://stackoverflow.com/q/2586975/ --- https://stackoverflow.com/q/116650/ which I hope will help. You can further your research using "how to use curl with java php" as keywords. – Funk Forty Niner Jun 09 '17 at 16:18

1 Answers1

0

You can acomplish this by following this steps:

  1. In your demo.com website directory create a fil called "linkedwebsite.html".
  2. Add the following code inside the tag of that website (replace google.com with your example.com url):

<iframe style="border:none; margin:0;" src="https://google.com" width="100%" height="600" frameBorder="0">Browser not compatible.</iframe>
  • Thank you for the reply. But as mentioned in my question, i cannot use iframe because the example.com exists on our network only and is not global. if someone outside our network tries to excess that page, it would just respond back with "page not found" – Ammar Surti Jun 09 '17 at 16:54
  • @AmmarSurti What is your intended response when someone eoutside of the network attempts to access your demo.com? – GrumpyCrouton Jun 09 '17 at 18:24
  • @GrumpyCrouton demo.com opens up our company website, the main website. demo.com/linkedwebsite should open the internal network website which is example.com. This example.com is only available on our internal company network and operates on Java applet. – Ammar Surti Jun 09 '17 at 18:50
  • So why not use Alejandro's iframe idea when the user goes to demo.com/linkedwebsite, as the results would be the same whether it redirects or not. – GrumpyCrouton Jun 09 '17 at 18:54
  • @GrumpyCrouton The way i understand iframe works is that it display any global website in the frame. So if i add google.com in the iframe it would display that. BUT, as i mentioned above, the example.com website is available on our company's internal network only. So anyone on our network can access example.com by just typing it on the browser, but no one in the client side (out of our network) would be able to access it. – Ammar Surti Jun 09 '17 at 19:34
  • @AmmarSurti No, it's just like loading that web site on it's own. You should try it out, I bet it would work. You could even make the page 100% by 100% iframe to and hide the borders to make it look like its the actual page. – GrumpyCrouton Jun 09 '17 at 19:38
  • @GrumpyCrouton I will surely give it a try. But i think i need to rephrase this. the example.com is actually an internal IP address. We someone in our network types this IP address, it takes them to a machine diagnostics page. Now we need this IP address available for anyone outside our network to view. So if i add an iframe at demo.com/linkedwebsite, it will look for the IP address on the client side which wont be found. The IP address is static but not global, its privatized in our network only. – Ammar Surti Jun 09 '17 at 19:49
  • @GrumpyCrouton So basically, the iframe code will look like: '' – Ammar Surti Jun 09 '17 at 19:50
  • @AmmarSurti Ah so your intended response as I was asking about earlier is that it shows the user the page even if they aren't on your network? – GrumpyCrouton Jun 09 '17 at 19:50
  • @GrumpyCrouton Yes Sir. The Users are not on our network. they could be anywhere in the world.. – Ammar Surti Jun 09 '17 at 19:51
  • @AmmarSurti Ah than that certainly won't work. I probably can't help you much then, I don't know Java very well, I'm sorry. – GrumpyCrouton Jun 09 '17 at 19:53
  • @GrumpyCrouton This is not related to java. the Java code cannot be edited or played around with. It just generates a web gui that need to be accessed over PHP and displayed on the web browser. So may be a screenshot method or anyother way we could send everything on '10.116.111.111' to demo.com/linkedwebsite. – Ammar Surti Jun 09 '17 at 19:55
  • Yes but I'm not sure how to intereact with the Java Applet in that way, where you can display it on outside networks – GrumpyCrouton Jun 09 '17 at 19:56
  • @GrumpyCrouton I see. Thank you. I will wait for other responses then. :) – Ammar Surti Jun 09 '17 at 19:57