ky818smKy818sm  2024-02-15 14:19 旷野小站 隐藏边栏 |   抢沙发  10 
文章评分 0 次,平均分 0.0

开启开启专家模式后,还需要修改nginx配置来实现重定向,还需要修改nginx配置来实现重定向

<br />
# WP Super Cache rules.<br />
# Designed to be included from a 'wordpress-ms-...' configuration file.</p>
<p>set $cache_uri $request_uri;</p>
<p># 请求方式为post时不使用缓存<br />
if ($request_method = POST) {<br />
        set $cache_uri 'null cache';<br />
}</p>
<p>if ($query_string != "") {<br />
        set $cache_uri 'null cache';<br />
}   </p>
<p># uri包含以下内容时不使用缓存<br />
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {<br />
        set $cache_uri 'null cache';<br />
}   </p>
<p># 对登录用户或已发布评论用户不使用缓存<br />
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {<br />
        set $cache_uri 'null cache';<br />
}</p>
<p># START MOBILE<br />
# 如果需要在移动端禁用缓存,可以把代码前的#删掉<br />
# if ($http_x_wap_profile) {<br />
#        set $cache_uri 'null cache';<br />
#}</p>
<p>#if ($http_profile) {<br />
#        set $cache_uri 'null cache';<br />
#}</p>
<p>#if ($http_user_agent ~* (2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800)) {<br />
 #       set $cache_uri 'null cache';<br />
#}</p>
<p>#if ($http_user_agent ~* (w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-)) {<br />
  #      set $cache_uri 'null cache';<br />
#}<br />
#END MOBILE</p>
<p># 如果存在缓存,则使用缓存,如果没有缓存,直接转向动态页面<br />
location /<br />
{<br />
	 try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?$args ;<br />
}<br />

location /
{
try_files $uri $uri/ /index.php?$args;
}
[/php]

注意:如果你本身设置了wordpress的伪静态规则,你需要把以下内容删除,否则nginx会报错

声明:本站许多内容均从网上收集整理,若有内容侵犯到您的权益,请通过邮件【6167555@qq.com】联系本站,我们将及时删除!

有问题请点我联系站长

「点点赞赏,手留余香」
HIDE

声明:本文为原创文章,版权归所有,欢迎分享本文,转载请保留出处!

发表评论

表情 格式 链接 私密 签到
扫一扫二维码分享