2015-10-04 85 views
0

我有目錄offering-pages工作的WordPress htaccess的不是我的域名與子目錄

產品-頁/代碼的.htaccess是

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ./index.php [L] 
</IfModule> 
# END WordPress 

我訪問WordPress的儀表板,只有我的網站的主頁。 當我去到其他頁面像http://domain/offering-pages/offerings-for-students/它顯示domain/index.php

+0

難道你不小心寫了'發行-page',而不是'發行,pages'? – Victor

+0

ya其提供頁面不提供頁面 –

+0

'RewriteRule ./index.php [L]' - '.'和'/ index.php'之間應該有一個空格(否則這個指令不會有幫助) 。但是,這個.htaccess文件假設你的站點在文檔根目錄下(WordPress本身不管理它?)。如果這個.htaccess文件位於子目錄中,那麼「修復.htaccess文件」的一種方法是刪除'RewriteRule'替換的斜槓前綴,即。 '重寫規則。 index.php [L]'並完全刪除'RewriteBase'指令。 – MrWhite

回答

0

內容根據自己的名字試試這個腳本,並改變域和子域,並張貼WordPress的相關問題wordpress.stackexchange

RewriteEngine On 

# rewrite subdomains to separate folder 
RewriteRule ^subdomain/ - [L] 

RewriteCond %{HTTP_HOST} !^www\.domain\.com$ 
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com$ 
RewriteRule ^(.*)$ subdomain/$1 [L] 
# or if you want to rewrite sub.domain.com/test to /subdomain/sub/test 
#RewriteRule ^(.*)$ subdomain/%1/$1 [L] 

# force www 
RewriteCond %{HTTP_HOST} ^domain\.com$ 
RewriteRule ^(.*)$ http://www.domain.com/$1 [R] 


# BEGIN WordPress 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ./index.php [L] 
# END WordPress 
0

你安裝的WordPress在產品目錄中?如果是這樣,你需要改變index.php來指向你安裝Wordpress的目錄。

來源:

require(dirname(__FILE__) . '/wp-blog-header.php'); 

要:

require(dirname(__FILE__) . '/offering-pages/wp-blog-header.php'); 
+0

它不起作用給錯誤: - 未能打開流: –

+0

沒有這樣的文件或目錄你沒有回答我的問題。是或否,你是否將Wordpress安裝在與根不同的另一個子目錄中? –

+0

是的,我已安裝在子目錄 –