someone785 Posted October 15, 2014 Share Posted October 15, 2014 Hi, I have been working with domains and servers for a very long time but I simply cannot figure out a solution to my problem.I have a system that dynamically creates subdomains and access user-created pages based on the username. So a user may create "xyz.mydomain.com" and it will go to the home page of their site. They can also create other pages like "xyz.mydomain.com/bio" and it will go to the page they created and named "bio". My issue lies when I want to give the user a custom domain to use for their site. If they register xyz.com, I want to set up the server so that visitors can go to xyz.com/bio and it will show the content for "xyz.mydomain.com/bio" but without redirecting to mydomain.com. A frame redirect is not a solution because when a user clicks a link within the website, the URL needs to reflect the page that they clicked, so from the home page, if they click the 'bio' link, the URL needs to show "xyz.com/bio" Quote Link to comment https://forums.phpfreaks.com/topic/291639-how-to-make-a-custom-subdomain-point-to-a-custom-domain/ Share on other sites More sharing options...
requinix Posted October 15, 2014 Share Posted October 15, 2014 How are you doing the dynamic subdomains? Virtualhosts or a wildcard? Quote Link to comment https://forums.phpfreaks.com/topic/291639-how-to-make-a-custom-subdomain-point-to-a-custom-domain/#findComment-1493644 Share on other sites More sharing options...
someone785 Posted October 16, 2014 Author Share Posted October 16, 2014 not sure what virtualhosts is, but I have a wildcard subdomain setup and when a php file is accessed, it scans the subdomain that is currently used and grabs the corresponding user's page from the database. Quote Link to comment https://forums.phpfreaks.com/topic/291639-how-to-make-a-custom-subdomain-point-to-a-custom-domain/#findComment-1493907 Share on other sites More sharing options...
requinix Posted October 16, 2014 Share Posted October 16, 2014 not sure what virtualhosts is,So it's not that then. You have code that checks the subdomain, presumably using HTTP_HOST. Modify the code so that it does more than just check the subdomain, such as "if the host is X.mydomain.com then the user is X, else if the host is not *.mydomain.com then determine the user by looking up the entire hostname in the database". If you want more help then you'll have to explain the system in much more detail. Like where the subdomain checking takes place, how you're looking up the user, and where you're storing the custom domain names. And the code to go along with it. Oh, and this entire system will only work if you have dedicated hosting. Quote Link to comment https://forums.phpfreaks.com/topic/291639-how-to-make-a-custom-subdomain-point-to-a-custom-domain/#findComment-1493927 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.