php - Subdomains redirectionGet the solution ↓↓↓
With my current PHP knowledge, I know how to create a subdomain automatically via Plesk api when a user is created on my site. I can then redirect the
example.com/user via htaccess.
My question that I cannot figure out how to do, is how to redirect but also keep
user.example.com in the navigation bar, not the
I own a dedicated hosting environment so I have access to change pretty much any setting that I like.
Here are some suggestions: Don't use .htaccess for this. A very common use of .htaccess is to redirect all requests to a central file (generally index.php). In order to allow dynamic subdomains you need to make sure your virtual host is configured properly for that. And in order to redirect to the subdomain url you can use the built-in php function header. Example:
Share solution ↓
Link To Answer People are also looking for solutions of the problem: too few arguments to function laravel
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.