2013-09-10 23 views
0

我試圖從一個非WordPress的靜態主頁(index.html)使用按鈕啓動一個WordPress的網站。從索引啓動Wordpress網站

index.html將爲用戶提供一個選項,讓他們將他們的電子郵件聯繫信息或重定向到我單擊「Enter」按鈕時創建的WordPress網站。

當標準wordpress index.php文件位於站點根目錄下時,WordPress站點工作正常。當我用我自己的index.html文件(使用按鈕和聯繫碼)替換此文件時,我無法啓動wordpress index.php文件。我改名爲原來的WordPress的index.php來indexWP.php,我這裏使用的代碼建議調用文件從我的新的index.html文件:A button to start php script, how?

<form action="indexwp.php" method="get"> 
    <input type="submit" value="Enter"> 
</form> 

當我用上面的,它給了我一個404頁當我點擊Enter時未找到錯誤。

原來的WordPress的index.php看起來像這樣(更名爲indexwp.php):

<?php 
/** 
* Front to the WordPress application. This file doesn't do anything, but loads 
* wp-blog-header.php which does and tells WordPress to load the theme. 
* 
* @package WordPress 
*/ 

/** 
* Tells WordPress to load the WordPress theme and output it. 
* 
* @var bool 
*/ 
define('WP_USE_THEMES', true); 

/** Loads the WordPress Environment and Template */ 
require('./wp-blog-header.php'); 

我是小白,所以我懷疑它的東西,我與上面的示例代碼曲解。

+1

我寧願打自己的頭真的很難用自己的斷手不是使用一個網頁,不需要的「輸入」網頁...如果事情,殺死的用戶體驗。 – ppeterka

+2

在WordPress中創建一個頁面並將其分配爲首頁。或者只是創建'home.php'並定製它;完成。點擊此處查看更多信息http://codex.wordpress.org/Template_Hierarchy – elclanrs

+0

Enter用於進入Wordpress網站,因爲它在施工時受到密碼保護。索引。html應該是一個獨立於wordpress的單獨而簡單的頁面,所以我不必在wordpress中爲臨時主頁處理header/nav/footer抑制。 – David

回答

0

你可以使用你的.htaccess以下(低於WordPress的定義)

DirectoryIndex index.html 

的Index.html是你的頁面和的index.php是的WordPress。

但WordPress的使用沒有index.php的域名爲它的主頁,所以你不斷被拋入你的index.html(登錄頁面)。如果設置了cookie(或其他),您將需要自動重定向到index.php。

如果你真的想要一個像這樣的輸入頁面,最好將Wordpress安裝在一個子目錄中。然後,您可以將/index.html重定向到/WP/index.php。

檢查this article(及其鏈接)用於在子目錄中開發Wordpress。

0

假設您使用apache2 web服務器,也許.htaccess可以幫助或導致問題。

怎麼樣:DirectoryIndex index.php規則。這裏apache2將使用index.php作爲目錄列表,用戶現在可以訪問exapmle.com/index.html。

更好,爲什麼不創建一個home.php文件,添加你的index.html的代碼,然後參考home.php喜歡example.com/home使用htaccess的去除,如名「.php」擴展: RewriteRule ^home$ $1.php

從來沒有與靜態index.html。

好運:)