2013-05-02 55 views
0

我在子目錄上有一個全新的WP多站點網絡(v 3.5.1)。我收到圖片的錯誤,其中子網站將無法正確顯示它們,但它們正確上傳。我很確定我需要做的是將正確的RewriteRule添加到主站點中的.htaccess文件中,因此:爲WordPress多站點添加RewriteRule

當從站點中的任何位置調用圖像時,URL是:example.com/subsitename/assets/sites/#/imagename.jpg。我想對其進行更改,以便圖像實際從以下位置抽取:example.com/assets/sites/#/imagename.jpg,其中subsitename#imagename.jpg都是變量。

看起來這應該非常簡單,但我很難找到正確的語法或解決此問題的其他人的示例。有誰知道我會添加適當的RewriteRule?

我現在的.htaccess文件包含此:

RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 

# add a trailing slash to /wp-admin 
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] 

RewriteCond %{REQUEST_FILENAME} -f [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule^- [L] 
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] 
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] 
RewriteRule . index.php [L] 

回答

2

代替試試這個:

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L]   

# uploaded files 
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L] 

# add a trailing slash to /wp-admin 
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] 

RewriteCond %{REQUEST_FILENAME} -f [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule^- [L] 
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L] 
RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L] 
RewriteRule . index.php [L] 
</IfModule> 
# END WordPress