最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】在线的wordpress搬家到本地结果无法打开首页却出现文件保存对话框和Front to the WordPress application

WordPress crifan 6176浏览 0评论

【问题】

在线的wordpress搬家,备份好数据和文件后,

放在本地的wamp中去测试是否ok。

但是打开首页:

http://localhost/backuped_wordpress

不是去打开页面,却出现了文件保存对话框了:

access wordpress but show popup window_thumb

所以看来还是出错了。

【解决过程】

1.去检查了一下对应的root用户是否有权限访问此backuped_wordpress数据库:

check root whether access database_thumb

root can access this database_thumb

所以结论是可以的。

2.后来通过对比,发现

backuped_wordpress\.htaccess

中的内容貌似有问题。所以把默认的:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

改为:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /backuped_wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /backuped_wordpress/index.php [L]
</IfModule>

# END WordPress

然后再去访问:

http://localhost/backuped_wordpress

结果问题依旧。

3.然后就下载那个弹出的文件:vZQOTUDg.part

内容为:

<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require('./wp-blog-header.php');

后来参考:

WordPress在根目录中显示子目录下的BLOG内容 | 未完待续

然后回去找,才发现,原来这个内容就是wordpress根目录下的index.php

4.之前的对比wp-config.php发现,我这里的有这部分内容:

/**#@+
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
define('AUTH_KEY',         '5kVnEPTtw...........tGzyPT');
define('SECURE_AUTH_KEY',  'KWZFmI75F...........LhC8TH');
define('LOGGED_IN_KEY',    'oqAPTTSUO...........69PEwr');
define('NONCE_KEY',        'NDNDleklr...........agBufT');
define('AUTH_SALT',        'K1h4Caspf...........E7s1jP');
define('SECURE_AUTH_SALT', 'dZKKIPigJ...........fHKVN7');
define('LOGGED_IN_SALT',   'Uo3aa9Lxw...........PX7J2N');
define('NONCE_SALT',       'TgaO6bdGe...........4LDdP7');

而正常运行的本地的另外一个wordpress中却是

define('AUTH_KEY',         'put your unique phrase here');
define('SECURE_AUTH_KEY',  'put your unique phrase here');
define('LOGGED_IN_KEY',    'put your unique phrase here');
define('NONCE_KEY',        'put your unique phrase here');
define('AUTH_SALT',        'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT',   'put your unique phrase here');
define('NONCE_SALT',       'put your unique phrase here');

所以,试着也改为

put your unique phrase here

看看效果。

结果问题依旧。

5.重启了wamp,还是问题一句。

6.参考:

wp问题,后台地址进不了,内部连接打不开.

去先登录登录界面:

localhost/backuped_wordpress/wp-login.php

结果还是要保存文件:

wp-login still show save file window_thumb

所以此刻才明白,原来访问对应的路径,只是下载文件而已。

无法执行php的wordpress的代码。

7.后来注意到了,由于当前

backuped_wordpress\.htaccess

中包含了这个:

# Use PHP5 Single php.ini as default
AddHandler application/x-httpd-php5s .php

wordpress\.htaccess

中是没有的。

所以去掉这个试试。

然后终于可以打开页面,而不是下载文件了。

 

【总结】

无法打开wordpress首页,是由于

.htaccess

多了行:

# Use PHP5 Single php.ini as default
AddHandler application/x-httpd-php5s .php

去掉就可以了。

 

而该行的存在,是由于,之前的wordpress是放在(hostmonster的)虚拟主机的linux服务器上面的。

且新增一个单独的php.ini放在wordpress根目录,便于设置相应的参数的。

所以才增加了这一行。

转载请注明:在路上 » 【已解决】在线的wordpress搬家到本地结果无法打开首页却出现文件保存对话框和Front to the WordPress application

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
90 queries in 0.190 seconds, using 22.12MB memory