how do i perform a url redirection and masking?
I have url where i host my webinars which is provided by webinar hosting provider. I would like to change that url to something within my domain.
For eg. The webinar url is something like http://www.onlinemeetingnow.com/seminar/?id=d181a7640e
i would lik开发者_如何学编程e to change it look something within my domain.
www.mywebsite.com/webinar
Is this possible?
The simplest way of doing this would be to create a PHP script at the desired URL that simply does a readfile () of the target URL. That would give the appearance that your site is hosting the remotely hosted content.
<?php
readfile ('http://www.onlinemeetingnow.com/seminar/?id=d181a7640e');
?>
This approach does require allow_url_fopen to be enabled, which it might not be for security reasons. It also has issues regarding such things as cookies, for example. Say you are using this trick to link to a remote site that requires a login and uses cookies to implement it, people who are logged into the remote site would appear not to be logged in, as their cookie wouldn't be sent to the remote site when you readfile () it.
You could use curl instead, as you have a bit more control, and it doesn't require allow_url_fopen. It still wouldn't be ideal though.
If you can configure your server, you could possibly use something like proxypass or URL rewriting to hide the remote URL.
Other solutions include using an iframe to display the remote site, or using AJAX to load the remote page's markup and inject into your page, but these approaches have their own set of issues that you need to take into account.
In the end, is it really worth the effort needed and the compromises you will have to make to just have the URL appear to be locally hosted when it isn't?
Maybe you want to create that page(s) on your own site and within that page you load the onlinemeetingnow url. This can be done with an iframe or such or you can get the html code from the page (with Curl or something) and than load that into your own page.
精彩评论