Table of Contents
回复内容:
方法一
方法二
Home Backend Development PHP Tutorial 像点点、新浪博客那样用户自己提交二级域名并自动解析是怎么实现的?

像点点、新浪博客那样用户自己提交二级域名并自动解析是怎么实现的?

Jun 06, 2016 pm 08:48 PM
nginx php wordpress DNS

想用wordpress实现一个轻量级博客的功能(非wp mu),但是二级域名部分不知道怎么处理了,想知道像点点、新浪博客那样用户自己提交二级域名并自动解析是怎么实现的?

回复内容:

想用wordpress实现一个轻量级博客的功能(非wp mu),但是二级域名部分不知道怎么处理了,想知道像点点、新浪博客那样用户自己提交二级域名并自动解析是怎么实现的?

域名解析的 A 记录:

  1. @ ---> justjavac.com
  2. www ---> www.justjavac.com
  3. * ---> *.justjavac.com

用方式3可以实现,然后在 web 端由 PHP 处理,不需要 DNS 相关的编程。

看了半天没有回答对的,代理服务器(nginx、apache)转发就可以了,比如你是wang.sina.com直接转化成www.sina.com/wang

泛域名解析

泛解析
*.yuming.com
判断这个*就可以啦

方法一

  • 通过泛域名解析,将某个顶级域名下的所有的子域名都指向某个IP地址,然后通过HTTP服务器的virtual host来区分。

方法二

  • 自己建一个DNS服务器,然后将顶级域名添加一条NS记录指向该DNS服务器,这样所有的子域名就都交给自己建立的服务器来解析了。

同楼上,一般DNS解析服务商(像DNSPOD)都支持域名泛解析,可以添加类似 *.abc.com 的解析

然后你可以在自己的服务器的http服务(如nginx)根据域名来确定请求到哪个站点

或者在你的网站程序里,通过host判断用户是访问的哪个域名,然后展示不同的内容

一般都是通过泛域名来解析,而且现在很多服务商都支持!

泛解析 + 伪静态 就可以搞定

貌似别人问的是自动解析, 你们都答的什么?

我觉得可以 做一个泛解析, 转到某个特定 URL , 再用正则取到 用户名, 再用 htaccess 做转向或重写

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to display wordpress comments How to display wordpress comments Apr 20, 2025 pm 12:06 PM

Enable comments in WordPress website: 1. Log in to the admin panel, go to "Settings" - "Discussions", and check "Allow comments"; 2. Select a location to display comments; 3. Customize comments; 4. Manage comments, approve, reject or delete; 5. Use <?php comments_template(); ?> tags to display comments; 6. Enable nested comments; 7. Adjust comment shape; 8. Use plugins and verification codes to prevent spam comments; 9. Encourage users to use Gravatar avatar; 10. Create comments to refer to

WordPress website is online but cannot be searched WordPress website is online but cannot be searched Apr 20, 2025 am 09:00 AM

Reasons why WordPress websites cannot be found in search engines: 1. Indexing issues; 2. Content issues; 3. Website technical issues; 4. Link issues; 5. Other issues such as geographical restrictions, website name and social media presence.

How to close comments with wordpress How to close comments with wordpress Apr 20, 2025 am 11:54 AM

How to turn off a comment in WordPress? Specific article or page: Uncheck Allow comments under Discussion in the editor. Whole website: Uncheck "Allow comments" in "Settings" -> "Discussion". Using plug-ins: Install plug-ins such as Disable Comments to disable comments. Edit the topic file: Remove the comment form by editing the comments.php file. Custom code: Use the add_filter() function to disable comments.

How to copy wordpress code How to copy wordpress code Apr 20, 2025 pm 12:00 PM

How to copy WordPress code? Copy from the admin interface: Log in to the WordPress website, navigate to the destination, select the code and press Ctrl C (Windows)/Command C (Mac) to copy the code. Copy from a file: Connect to the server using SSH or FTP, navigate to the theme or plug-in file, select the code and press Ctrl C (Windows)/Command C (Mac) to copy the code.

How to upload source code for wordpress How to upload source code for wordpress Apr 20, 2025 pm 12:03 PM

You can install the FTP plug-in through WordPress, configure the FTP connection, and then upload the source code using the file manager. The steps include: installing the FTP plug-in, configuring the connection, browsing the upload location, uploading files, and checking that the upload is successful.

WordPress website building and avoid pits WordPress website building and avoid pits Apr 20, 2025 am 08:06 AM

Be cautious when building a WordPress website. The guide to breaking through pits helps you avoid risks: choose paid themes and avoid the quality and safety risks of free themes. "Less is more" when installing plugins to avoid website speed and compatibility issues. Regularly optimize the database to ensure the smooth operation of the website. Pay attention to security measures and regularly update and install security plug-ins. Modify the code carefully to avoid website crashes and do it in a test environment if necessary. Pay attention to performance optimization, improve website speed, and improve user experience.

WordPress website account login WordPress website account login Apr 20, 2025 am 09:06 AM

To log in to a WordPress website account: Visit the login page: Enter the website URL plus "/wp-login.php". Enter your username and password. Click "Login". Verification Two-step Verification (optional). After successfully logging in, you will see the website dashboard.

What to do if there is an error in wordpress What to do if there is an error in wordpress Apr 20, 2025 am 11:57 AM

WordPress Error Resolution Guide: 500 Internal Server Error: Disable the plug-in or check the server error log. 404 Page not found: Check permalink and make sure the page link is correct. White Screen of Death: Increase the server PHP memory limit. Database connection error: Check the database server status and WordPress configuration. Other tips: enable debug mode, check error logs, and seek support. Prevent errors: regularly update WordPress, install only necessary plugins, regularly back up your website, and optimize website performance.

See all articles