WordPress迁移时一些常见问题的解决方法整理_php技巧
一、导入数据库提示数据表已存在
以周良博客使用的主机商-主机91为例,提供了phpMyAdmin功能的,导入数据库只需要便捷的选择数据库,导入就可以了。方法虽然简单,但是有可能遇到提示database XXX table has existed。出现该问题的原因可能是之前转移的时候将网站文件上传到主机空间后,进行过一次网站安装,导致新建了一次数据库,创建了新的数据表,导致重新导入数据库时数据表重复。解决方法就是将查找到提示的这个已存在的XXX table,将它删除掉再重新导入。
二、网站文件和数据上传成功后,排版错乱
首先,我们需要检查一下网站的PHP版本设置是否正确,WordPress的话,一般是使用5.3或者5.4的PHP版本,如果是5.2的话,是有可能导致网站排版混乱的问题。以周良博客使用的主机91为例,登录到控制面板,在select php version 处修改为5.3版本即可。
如果修改了PHP版本还是无法生效,那么我们就需要检查网站加载网站文件的加载文件路径是否正确了。右键浏览器-审查元素中查看网站的加载情况,就有可能发现很多文件是没有加载出来的,再看访问路径就会发现网站访问路径和网站文件加载路径是不一致的,所以我们就需要连接到网站的数据库中,在数据库中的options表处将网站数据文件加载的路径修改与网站访问路径一致。
如果修改了PHP版本还是无法生效,那么我们就需要检查网站加载网站文件的加载文件路径是否正确了。右键浏览器-审查元素中查看网站的加载情况,就有可能发现很多文件是没有加载出来的,再看访问路径就会发现网站访问路径和网站文件加载路径是不一致的,所以我们就需要连接到网站的数据库中,在数据库中的options表处将网站数据文件加载的路径修改与网站访问路径一致。
三、访问主页空白
登录WordPress后台,外观-主题处查看是否已经上传启用迁移网站之前相对应的主题。如果没有发现之前的主题,则需要重新添加主题或者在控制面板处wp-content/themes重新上传该主题,然后在WordPress后台主题管理处启用该主题。
四、网站中的部分功能不能用
登录WordPress后台,插件管理-已安装的插件处,查看网站插件是否都已经全部启用,将对应网站功能的插件启用即可。
五、网站主页可访问,其他的选项点击没有反应或者提示404错误
登录主机空间控制面板,在文件管理处开启查看隐藏文件,查看.htaccess是否有正确的内容。一般初始化的.htaccess文件内容为:
<p># BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /WP/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /WP/index.php [L] </IfModule></p><p># END WordPress</p>
如果有设置重定向或者静态链接之类的也需要添加与之前网站相同的内容。
PS:推荐的插件备份方法
WordPress Move 是一个非常不错的网站备份还原插件,支持一键完整备份整个网站的所有文件和数据库,一键还原;还可以通过FTP发送备份文件到其他主机空间,实现网站搬家。该插件的备份打包是非常智能的,每个压缩包都可以单独解压。
启用插件后,在 设置 > WordPress Move,设置远程备份主机的FTP信息、每个数据库包和文件包的最大体积。
然后访问 工具 > Backup Manager 进行备份,可以单独备份数据库,也可以整站备份。备份的文件都会保存在该插件下的 backup 目录,所以备份前,请确保你的主机空间有足够的空间存放备份文件
备份过以后,访问 工具 > Migration Assistant,有 3 个功能可以用:
更改域名——可以更改当前网站的域名,它会批量替换数据库中的旧域名;
迁移——可以将你备份的文件和数据库发送到远程主机空间(也就是在上面设置的那个FTP),使用这个功能前,请先在远程主机空间同样安装WordPress 和 WordPress Move,然后将上面的 FTP 远程备份路径设置为该插件下的 backup 目录,这样,当发送完备份文件以后,就可以访问远程主机空间的 WordPress Move,通过“还原”功能进行还原,就实现了网站的搬家。
还原——可以从 backup 目录选择已备份的文件进行还原。
在后台插件安装界面搜索 WordPress Move 即可在线安装

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

There are four ways to adjust the WordPress article list: use theme options, use plugins (such as Post Types Order, WP Post List, Boxy Stuff), use code (add settings in the functions.php file), or modify the WordPress database directly.

WordPress IP blocking plugin selection is crucial. The following types can be considered: based on .htaccess: efficient, but complex operation; database operation: flexible, but low efficiency; firewall: high security performance, but complex configuration; self-written: highest control, but requires more technical level.

The steps to create a custom header in WordPress are as follows: Edit the theme file "header.php". Add your website name and description. Create a navigation menu. Add a search bar. Save changes and view your custom header.

WordPress editing dates can be canceled in three ways: 1. Install the Enable Post Date Disable plug-in; 2. Add code in the functions.php file; 3. Manually edit the post_modified column in the wp_posts table.

To log in to a WordPress website account: Visit the login page: Enter the website URL plus "/wp-login.php". Enter your username and password. Click "Login". Verification Two-step Verification (optional). After successfully logging in, you will see the website dashboard.

WordPress Error Resolution Guide: 500 Internal Server Error: Disable the plug-in or check the server error log. 404 Page not found: Check permalink and make sure the page link is correct. White Screen of Death: Increase the server PHP memory limit. Database connection error: Check the database server status and WordPress configuration. Other tips: enable debug mode, check error logs, and seek support. Prevent errors: regularly update WordPress, install only necessary plugins, regularly back up your website, and optimize website performance.

A step-by-step guide to replacing a header image of WordPress: Log in to the WordPress dashboard and navigate to Appearance >Theme. Select the topic you want to edit and click Customize. Open the Theme Options panel and look for the Site Header or Header Image options. Click the Select Image button and upload a new head image. Crop the image and click Save and Crop. Click the Save and Publish button to update the changes.

Enable comments in WordPress website: 1. Log in to the admin panel, go to "Settings" - "Discussions", and check "Allow comments"; 2. Select a location to display comments; 3. Customize comments; 4. Manage comments, approve, reject or delete; 5. Use <?php comments_template(); ?> tags to display comments; 6. Enable nested comments; 7. Adjust comment shape; 8. Use plugins and verification codes to prevent spam comments; 9. Encourage users to use Gravatar avatar; 10. Create comments to refer to
