Create a file main domain to subdomain

Actually I made a website. I have 2 domains on hosting. I want when a user registers on main domain website then a id.php file is created according to his ID in the subdomain of my hosting. Like this:>>
One thing to note is that I have the code to register but no code to create such a file.

  1. /htdocs main domain folders
  2. / subdomain folders

    But it’s not a real domain…I just need help. Learning purpose only

For security reasons, different domains in the same account cannot access the files of other domains on the same account.

But instead of generating a different PHP file for each visitor, perhaps you could use .htaccess rules and a MySQL database instead?

So, from a high level perspective:

  1. A user signs up, and a record is created in the databaase for this user with a unique user ID.
  2. On the other domain, there is a .htaccess rule that captures all URLs that look like /users/X.php and directs it to a single PHP file.
  3. Within the single PHP file, you retrieve the user ID from the URL, find the relevant database record, and show the content of the user page.

This has a few advantages, like making it easier to update the site later on without having to edit many very similar user files, and not having a maximum user limit through the inode limit.


I am new so it is very difficult for me to do that. Please let me know from where I can get help in this matter

Google can help you with both .htaccess and MySQL. If you have a specific question that Google can’t anwser, we will be happy to help.


My question is above. And it was answered by an admin. Please let me know how to do it like the answer given by that admin

It would take me hours to write such a tutorial. That is why google exists. Here, I’ll get you started:

Login/Signup Form

Redirect matching URLs

Select information from database


We can’t just tell you how to do that. It mainly involves writing code to add functionality to your site. We haven’t seen a single line of code of your site, and have no idea what it’s supposed to do except for showing a user specific page on another domain.

And before you start answering that question: you’re basically asking to write your website’s code for you. I doubt you’ll find many people will to just do that for you.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.