1. wdcp教程之解决NGINX的WORDPRESS伪静态规则失效的
解决NGINX的WORDPRESS伪静态规则失效的问题前两天搬到了EMSVPS的PR线路上,用上了最新的WDCP2。
0管理面板,支持多用户管理(我们几个合租的VPS,最需要这个功能了),感觉很不错,屁颠屁颠的把网站搬过来了,然后设计wordpress伪静态规则。 我还是使用的是WDCP1。
0时代的wordpress伪静态规则try_files $uri $uri/ /index。php?q=$request_uri;结果重启nginx,还是显示404。
这就让我纠结了。后来我有测试一个网上最普遍的try_files $uri $uri/ /index。
php?q=$uri&$args;结果还是失效,急的我像是热过上的蚂蚁啊,又在网上陆续找了一些伪静态规则,没一个成功了。重启服务器重启了N次。
黄天不负有心人,最后终于让我找到了一条可以用的rewrite ^。*/files/(。
*)$ /wp-includes/ms-files。 php?file=$1 last;if (!-e $request_filename) {rewrite ^。
?(/wp-。*) $1 last;rewrite ^。
?(/。*/。
php)$ $1 last;rewrite ^ /index。 php last;}根据这条规则发明人的解释,第一条规则try_files $uri $uri/ /index。
php?q=$request_uri;会让所有的找不到的目录和文件跳转到index。php处理,很有可能是我的index。
php权限问题或者其他原因导致不能将伪静态地址映射到真实地址中去。 所以才会出现这个纠结的问题。
本文教程摘自 再用记事本把下面的 东西 复制进去 改名称httpd.ini 放在根目录里 就可以了 # 3600 = 1 hourCacheClockRate 3600RepeatLimit 32# 中文tag解决RewriteRule /tag/(.*) /index.php?tag=$1# Protect httpd.ini and httpd.parse.errors files# from accessing through HTTP# Rules to ensure that normal content gets throughRewriteRule /robots.txt /robots.txt RewriteRule /sitemap.xml /sitemap.xml RewriteRule /favicon.ico /favicon.ico # For file-based wordpress content (i.e. theme), admin, etc.RewriteRule /wp-(.*) /wp-$1 # For normal wordpress content, via index.phpRewriteRule ^/$ /index.php RewriteRule /(.*) /index.php/$1。
转载请注明出处51数据库 » wordpress伪静态主题失效
爱是抹不去的心伤