解决wordpress快速发布”Press-This.php”出现404错误的方法

12:49 分类: wordpress 作者:Bin

如果你使用wordpress的“快速发布”功能。可能会遇到如下问题:

点击快速发布书签后,出现:

Forbidden

You don’t have permission to access /blog/wp-admin/press-this.php on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

下面是一种解决方法:

Try this…

Edit the text in the “Press This” link 编辑书签栏里的“快速发布”链接

形如:javascript:var%20d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f=’http://www.blogay.cn/blog/wp-admin/press-this.php’,l=d.location,e=encodeURIComponent,g=f+’?u=’+e(l.href)+&t=’+e(d.title)+’&s=’+e(s)+’&v=2′;function%20a(){if(!w.open(g,’t',’toolbar=0,resizable=0,scrollbars=1,status=1,width=720,height=570′)){l.href=g;}}setTimeout(a,0);void(0);

Replace: 作如下替换:将

u=’+e(l.href)+’

With: 替换为
u=’+e(l.href.replace(/\//g,’\\/’))+’

参考资料:WordPress › Support » “Press This” results in 404.

同时修改wp-admin/tools.php:

<p><a href=”<?php echo htmlspecialchars( get_shortcut_link() ); ?>” title=”<?php echo esc_attr(__(‘Press This’)) ?>”><?php _e(‘Press This’) ?></a></p>

红色部分直接替换为上面修改后的链接,形如:javascript:var%20d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f=’。。。/blog/wp-admin/press-this.php’,l=d.location,e=encodeURIComponent,g=f+’?u=’+e(l.href.replace(/\//g,’\\/’))+’&t=’+e(d.title)+’&s=’+e(s)+’&v=2′;function%20a(){if(!w.open(g,’t',’toolbar=0,resizable=0,scrollbars=1,status=1,width=720,height=570′)){l.href=g;}}setTimeout(a,0);void(0);