haku Posted February 25, 2009 Share Posted February 25, 2009 Can you do cross-domain mod rewrite? For example, if I have example.com and test.com, and I want test.com/file.html to be displayed when someone accesses example.com/file.html, can that be done? Quote Link to comment https://forums.phpfreaks.com/topic/146861-cross-domain-mod-rewrite/ Share on other sites More sharing options...
premiso Posted February 25, 2009 Share Posted February 25, 2009 Do you own both the domains? If so it can be done by including the file. You can also do a 301 redirect from example.com to test.com. If you just want the end result, you can always use file_get_contents and just pull that file (web or on the server) into that file.html. I am not really sure what you are after though. Let me know if you need more information, and I may be able to find out for ya. Quote Link to comment https://forums.phpfreaks.com/topic/146861-cross-domain-mod-rewrite/#findComment-771005 Share on other sites More sharing options...
haku Posted February 25, 2009 Author Share Posted February 25, 2009 Well, I'm developing a re-usable form for a company I contract out to. They will be selling it to other companies, but want to keep it hosted on their server. One option they want to add is that the company they sell it to can have the form as a page on their domain, but with the form and database still hosted on the company I contract to's server. Ex - I am developing for for A Co. who have the domain aco.com. They will sell the form to B Co. who have bco.com on a different server altogether. The form will then be at bco.com/form.php, but form.php will be hosted on aco.com's server. Quote Link to comment https://forums.phpfreaks.com/topic/146861-cross-domain-mod-rewrite/#findComment-771039 Share on other sites More sharing options...
premiso Posted February 25, 2009 Share Posted February 25, 2009 Gotcha. I do not think mod_rewrite would work here, I am unsure how the form is setup, but basically you want them to be able to access that form but look like it is just coming from their page. And I take it the form contains certain data so just using file_get_contents or curl would not work. How I would set it up, is the form.php on the main host server requires an access hash to access that form. Using cURL or the get contents it must be passed via get, then you can use that hash to pull the form from that database, build it up then return it to that page. However, if it is just a simple html form, whats to stop them from just copying it and creating their own file? The hard part will be "Securing" the form from being copied, which I do not think is possible. I could however be interpreting this wrong. Quote Link to comment https://forums.phpfreaks.com/topic/146861-cross-domain-mod-rewrite/#findComment-771049 Share on other sites More sharing options...
haku Posted February 25, 2009 Author Share Posted February 25, 2009 I'm not worried about them copying the form itself, it's the processing behind it. And I want all the data to co into A Co's database. I wonder if I could just put the form B Co's server, but have the post data submit to be processed on A Co's server. Can you post data from a form on one domain to a script on another domain? Quote Link to comment https://forums.phpfreaks.com/topic/146861-cross-domain-mod-rewrite/#findComment-771069 Share on other sites More sharing options...
premiso Posted February 25, 2009 Share Posted February 25, 2009 Yes, you can post data from one site to another (that is essentially how some spam bots works). Quote Link to comment https://forums.phpfreaks.com/topic/146861-cross-domain-mod-rewrite/#findComment-771111 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.