D
D
deleted-mezhevikin2011-04-26 19:57:57
Domain name market
deleted-mezhevikin, 2011-04-26 19:57:57

Linking domains to a profile on the site

It is necessary to make it possible for users to bind their own domain mydomen.com to their site.ru/username profile so that this profile is displayed by domain. In what direction to dig? On what basis is this done?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Z
zizop, 2011-04-27
@deleted-mezhevikin

To solve this problem, it is desirable to have your own DNS server, or to be able to add records to the provider's DNS server.
1. Add a zone for your domain to the server ip.
2. Set up server software (apache/nginx) to process requests for this domain.
3. Through mod_rewrite (as advised above) or the nginx config, direct all requests to your web application (index.php as an entry point).
4. Next, do the HTTP_HOST analysis, as WNeZRos wrote above.

R
Roman, 2011-04-26
@WNeZRoS

If the question is how to process access to a site using a foreign domain, you need to look at HTTP_HOST (for php $_SERVER['HTTP_HOST']) and search for such a domain in the database, determine which user it belongs to, and show the page of this user.
If the question is how to change the dns of the user's domain to yours, then I think this cannot be done without additional information about the registrar, login and password.

E
ertaquo, 2011-04-26
@ertaquo

Is your own domain something like username.site.ru? Then you need to disable the automatic addition of subdomains in the hosting settings (if there is such an option; for example, the Majordomo hosting provider), and then process it in .htaccess or a script.
Redirecting from username.site.ru/something to site.ru/username/something can be written like this:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^([a-zA-Z0-9]+)\.([a-z-]+\.[a-z]{2,6})$ [NC]
RewriteRule ^/(.*)$ %2/%1/$1 [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question