2015-10-16 50 views
1

我有一個Wordpress博客爲我們的教會。我們有一個名爲「佈道」的實際目錄,我們在網站上也有一個叫佈道的部分。我需要能夠去http://ourchurch.org/sermons並獲得佈道清單或http://ourchurch.org/sermons/sermon-title/並獲得佈道。Mod_Rewrite問題 - 顯示Wordpress內容與列表目錄

但是,如果我去http://ourchurch.org/sermons/speakername/sermon.mp3我需要它播放或下載MP3。 PDF文件也一樣。

一切正常除了佈道清單頁面。當我去:http://ourchurch.org/sermons它給了我一個目錄列表。我需要它來允許WordPress規則工作以將其引導到正確的內容頁面。

這是我目前有:

# Use PHP5.4 as default 
AddHandler application/x-httpd-php54 .php 

# 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] 

RewriteCond %{REQUEST_FILENAME} -f 
RewriteCond %{REQUEST_URI} ^/sermons/(.+)/*\.(mp3|pdf)$ [NC] 
RewriteRule ^(.*)$ - [L] 

</IfModule> 

# END WordPress 

我在做什麼錯?

在此先感謝您的幫助!

+0

爲什麼您需要重寫現有文件的請求?是否有我缺少的要求? –

+0

不需要現有的文件,但網址http://ourchurch.org/sermons現在拉起來:https://www.dropbox.com/s/f7oy4aexa6y4z2r/Screenshot%202015-10-16%2017.44.53。 png?dl = 0,但我需要它來拉起wordpress頁面。 –

回答

2

也許在你的RewriteRule列表的頂部添加這個?

它將以佈道或佈道結尾的請求路由到/ index.php - 這是WordPress。

RewriteRule sermons/?$ index.php [L]