我正在尝试修改中给出的重写规则Develop Locally, Use Images from Production 在我的本地开发站点(在XAMPP上运行)上执行同样的操作。
这就是开发网站.htaccess
看起来,最后添加了代码段(显然,URL替换为example.com等效的URL):
<IfModule mod_php.c>
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
</IfModule>
#START WORDPRESS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
# Redirect About and Library to first sub page
RewriteRule ^about/?$ /wordpress/about/history/ [L,NC,R=301]
RewriteRule ^the-library/?$ /wordpress/the-library/gallery/ [L,NC,R=301]
RewriteRule ^index\\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
# If images not found on development site, load from production
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/[^\\/]*/.*$
RewriteRule ^(.*)$ https://www.example.com/$1 [QSA,L]
</IfModule>
#END WORDPRESS
重写规则似乎没有什么不同,无论是HTTPS还是HTTP版本的URL。对于开发人员站点不可用的图像不会显示,即使对于生产站点加载相同的图像也不会显示。我也没有成功地尝试修改本文中的重写规则slightly different question 应用于Wordpress Multisite。
此外,我之前在stop Wordpress from modifying the .htaccess file, 所以我很确定这不是问题的原因。
我的重写规则有什么问题导致它失败?