Home  >  Article  >  Backend Development  >  Please tell me how to add a static page before cms

Please tell me how to add a static page before cms

WBOY
WBOYOriginal
2016-08-04 09:21:291041browse

Server:ubuntu 14.04 nginx php5

One domain name:a.com

Deploy a CMS system similar to WordPress, but now it is required to add a static page before WordPress. When accessing the website, this static page will be displayed first, and then you can click on the window on the static page to enter WordPress.

How to achieve this?

Reply content:

Server:ubuntu 14.04 nginx php5

One domain name:a.com

Deploy a CMS system similar to WordPress, but now it is required to add a static page before WordPress. When accessing the website, this static page will be displayed first, and then you can click on the window on the static page to enter WordPress.

How to achieve this?

Assume the domain name is a.com and the static page is index.html. You can set it as follows:

<code>server {
    listen 80;
    server_name a.com;
    
    root /var/www/a.com;
    
    location / {
        index index.html index.php;
        try_files $uri $uri/ /index.php&is_args&args;
    }
    
    location ~ \.php {
        # php fastcgi 相关配置
    }
    
}</code>

The above configuration can be done. When a static page exists, the static page will be displayed. When it does not exist, it will be processed by index.php (that is, wordpress). index index.html index.php; This line can be opened in a. com/, index.html is accessed by default (if this file exists), so the configuration will fully meet your needs.

Suppose your domain name is a.com, the homepage is a.com/index.html, put wordpress under a.com/wordpress/
and then configure nginx like this:

<code>server {
    listen 80;
    server_name a.com;
    
    location / {
        index index.html;
        root 你的静态页面路径;
    }   
    
    location /wordpress {
        index index.php index.html;
        root 你的wordpress路径;
        # 这里放wordpress 和 PHP 的配置
    }
}</code>

Deploy wordpress in a column under a.com

I don’t quite understand this requirement. Is there any special business requirement that does not allow this static page to be placed in wordpress?

In addition to the method above
Of course you can also use a subdomain name:
Put your static page on static.a.com
Put wordpress on www.a.com

This should be more beneficial to SEO

One more thing, WP background custom theme can set a static homepage.
Sorry, I misread it, it’s not WP.

Statement:
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