2013-04-14 41 views
3

我想在子目錄中安裝WordPress,並刪除永久鏈接中的index.php。 服務器是IIS 6.0,支持重寫。 我的網絡服務器具有以下目錄:.htaccesss RewriteCond%{REQUEST_FILENAME}!-d不起作用

根目錄
--wp [WordPress的文件夾]

根目錄/的.htaccess

RewriteCond %{HTTP_HOST} ^(www\.)?a.luckyet\.com$ [NC] 
RewriteCond %{REQUEST_URI} !^/wp/ 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /wp/$1 
RewriteCond %{HTTP_HOST} ^(www\.)?a.luckyet\.com$ [NC] 
RewriteRule ^(/)?$ wp/ 

根目錄/ WP /的.htaccess

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f #1 
RewriteCond %{REQUEST_FILENAME} !-d #2 
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] #3 

它的工作原理,當我訪問a.luckyet.coma.luckyet.com/hello-world.html 但是,當我訪問它不工作a.luckyet.com/wp-login .PHPa.luckyet.com/wp-admin

#3工作正常,但#1和#2不能正常工作。然後,我看到here和改變根目錄/ WP /的.htaccess到內容:

RewriteEngine on 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] 

它仍然沒有生效。誰能幫我?提前致謝!

更新:

的ISAPI_Rewrite版本是3.0。

根目錄中的所有代碼/ htaccess的

​​

根目錄中的所有代碼/ WP/htaccess的

RewriteEngine on 
# For file-based wordpress content (i.e. theme), admin, etc. 
RewriteRule wp-(.*) wp-$1 [L] 
# For normal wordpress content, via index.php 
RewriteRule ^/$ index.php [L] 
RewriteCond %{REQUEST_FILENAME} !-f #1 
RewriteCond %{REQUEST_FILENAME} !-d #2 
RewriteRule (.*) index.php/$1 [L] 

WordPress的固定鏈接是:

/%postname%.html 

因此,WordPress的可以工作K精當訪問http://a.luckyet.com/http://a.luckyet.com/hello-world.html

問:

如果有像a.html一個真實的文件中根目錄/ WP/,如根目錄/ WP/a.html,WordPress的404錯誤將在訪問時報告http://a.luckyet.com/a.html,。我怎樣才能解決這個問題?

+0

這應該是'的RewriteCond%{DOCUMENT_ROOT}%{REQUEST_URI}!-f'或'!-d'。你使用的是什麼ISAPI_Rewrite版本? –

+0

謝謝,但它仍然無效。我也不知道ISAPI_Rewrite版本,它是我購買的虛擬主機。 – zwee

+0

我更新了這個問題,是否有任何方法可以解決這個問題? – zwee

回答

0

您正在使用.htaccess文件和WordPress設置動態地重寫URL以添加.html擴展名 - 任何「真實生活」.html文件的文件都由IIS Handler Mappings上游處理。

你必須更新你的IIS處理程序映射爲.html文件尤其是直接將請求定向到物理文件。

相關問題