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

AI Hentai Generator
Generate AI Hentai for free.

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

PHP and Flutter are popular technologies for mobile development. Flutter excels in cross-platform capabilities, performance and user interface, and is suitable for applications that require high performance, cross-platform and customized UI. PHP is suitable for server-side applications with lower performance and not cross-platform.

You can easily modify your WordPress page width by editing your style.css file: Edit your style.css file and add .site-content { max-width: [your preferred width]; }. Edit [your preferred width] to set the page width. Save changes and clear cache (optional).

Create a product page in WordPress: 1. Create the product (name, description, pictures); 2. Customize the page template (add title, description, pictures, buttons); 3. Enter product information (stock, size, weight); 4 . Create variations (different colors, sizes); 5. Set visibility (public or hidden); 6. Enable/disable comments; 7. Preview and publish the page.

WordPress posts are stored in the /wp-content/uploads folder. This folder uses subfolders to categorize different types of uploads, including articles organized by year, month, and article ID. Article files are stored in plain text format (.txt), and the filename usually includes its ID and title.

WordPress template files are located in the /wp-content/themes/[theme name]/ directory. They are used to determine the appearance and functionality of the website, including header (header.php), footer (footer.php), main template (index.php), single article (single.php), page (page.php), Archive (archive.php), category (category.php), tag (tag.php), search (search.php) and 404 error page (404.php). By editing and modifying these files, you can customize the appearance of your WordPress website

The most stable WordPress version is the latest version because it contains the latest security patches, performance enhancements, and introduces new features and improvements. In order to update to the latest version, log into your WordPress dashboard, go to the Updates page and click Update Now.

Search for authors in WordPress: 1. Once logged in to your admin panel, navigate to Posts or Pages, enter the author name using the search bar, and select Author in Filters. 2. Other tips: Use wildcards to broaden your search, use operators to combine criteria, or enter author IDs to search for articles.

1. On the old device, click "Me" → "Settings" → "Chat" → "Chat History Migration and Backup" → "Migrate". 2. Select the target platform device to be migrated, select the chat records to be migrated, and click "Start". 3. Log in with the same WeChat account on the new device and scan the QR code to start chat record migration.
