How does PHP make different domains point to the same page

Source: Internet
Author: User
I am a front-end, contact background not long time, see today there are two top-level domain names, the input domain name is the same page opened, but the address bar has not changed, do not know what this principle, who knows?

Reply content:

I am a front-end, contact background not long time, see today there are two top-level domain names, the input domain name is the same page opened, but the address bar has not changed, do not know what this principle, who knows?

It's all right upstairs. Two domain names pointing to the same page (app), in addition to the server configuration, can also be set CNAME解析 so that their different domain access has the same effect

nginxThe service configuration such as

server {    listen       80;    # 这里使两个不同的域名具有同样的访问效果    server_name  www.baidu.com www.godruoyi.com;        charset utf-8;    root   /data/admin_www/www;    location / {        index  index.html index.htm index.php;        if (!-e $request_filename) {            rewrite ^/(.*) /index.php?$1 last;        }    }        location ~ \.php$ {        fastcgi_pass    unix:/dev/shm/php-fpm.sock;        #fastcgi_pass    127.0.0.1:9000;        fastcgi_index   index.php;        fastcgi_param   SCRIPT_FILENAME  $request_filename;        include         fastcgi_params;    }    error_page   500 502 503 504  /50x.html;    location = /50x.html {        proxy_pass http://$host/error/index;     }}

Server configuration, configure different domains to point to the same project.

This has nothing to do with PHP.
The admin console of the domain name resolves two domain names to the same server.

Server control side can be customized

Two domains bound to the same IP

This is configured on the server, as with the project deployment, support domain name many to one

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.