請教一個cms之前加個靜態頁面的解決辦法

來源:互聯網
上載者:User
伺服器: ubuntu 14.04 nginx php5

網域名稱一個:a.com

部署一套類似wordpress的cms系統,但是現在要求在wordpress之前加個靜態頁面,訪問網站的時候首先顯示這個靜態頁面,然後可以點擊靜態頁面上的視窗進入wordpress。

請問如何??

回複內容:

伺服器:ubuntu 14.04 nginx php5

網域名稱一個:a.com

部署一套類似wordpress的cms系統,但是現在要求在wordpress之前加個靜態頁面,訪問網站的時候首先顯示這個靜態頁面,然後可以點擊靜態頁面上的視窗進入wordpress。

請問如何??

假設網域名稱是 a.com 靜態頁面是 index.html 你可以如下設定:

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 相關配置    }    }

如上配置可以做到,當存在靜態頁面的時候,即顯示靜態頁面,不存在的時候由 index.php(也就是 wordpress) 來處理,index index.html index.php; 這一行可以在開啟 a.com/ 的時候預設訪問到index.html(如果這個檔案存在),這樣配置就完全滿足了你的需求。

假設你的網域名稱是a.com,首頁是a.com/index.html,把wordpress放在a.com/wordpress/
然後nginx這麼配置:

server {    listen 80;    server_name a.com;        location / {        index index.html;        root 你的靜態頁面路徑;    }           location /wordpress {        index index.php index.html;        root 你的wordpress路徑;        # 這裡放wordpress 和 PHP 的配置    }}

把wordpress部署在a.com下面的一個欄目中

不是很明白這個需求,是什麼特別的業務需求不允許這個靜態頁放到wordpress裡面嗎?

除了樓上的方法
當然還可以用子網域名稱:
你的靜態頁就放在static.a.com
wordpress 就放在www.a.com

這樣應該更有利於SEO

補充一個,WP後台自訂佈景主題,可以設定一個靜態首頁。
不好意思看錯了,並不是WP。

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.