【发布时间】:2023-04-09 18:54:02
【问题描述】:
我正在尝试将一个 Wordpress 网站克隆到一个子目录中。所以,我将有两个安装,一个在域的根目录,一个在 /test。我的问题是,即使我在数据库中更改了 siteurl 和 home uri 的值,我的链接也会重定向到 root。所以,像 domain.com/test/contact 这样的页面会重定向到 domain.com/contact,这不是我想要的。
【问题讨论】:
我正在尝试将一个 Wordpress 网站克隆到一个子目录中。所以,我将有两个安装,一个在域的根目录,一个在 /test。我的问题是,即使我在数据库中更改了 siteurl 和 home uri 的值,我的链接也会重定向到 root。所以,像 domain.com/test/contact 这样的页面会重定向到 domain.com/contact,这不是我想要的。
【问题讨论】:
您需要按照以下步骤将您的 WordPress 网站从生产服务器克隆到登台服务器 -
1. First export database of production server WordPress website and open SQL file in an text editor.
2. Then find your domain name(domain.com) and replace it at all places with your domain name/test like domain.com/test.
3. Import production SQL file to test database from phpmyadmin.
4. Open staging WordPress admin like domain.com/test/wp-admin and go to Settings > Permalink section. Just click on the Save button to update htaccess file.
5. Optionally you can go to setting at admin page and save all general settings, menus and check Widgets area too.
6. Now you can access your domain.com/test WordPress website.
【讨论】:
也许是因为你的 htaccess 设置重写了。 看看它或在此处发布。
【讨论】:
好答案,anil-meena 然而,这 5 个步骤可以使用 wordpress 插件自动完成 WP Staging。我开发这个插件是因为手动创建克隆站点进行测试的过程需要太多时间,而且对于普通用户来说太复杂了。 所以我希望它对你有用。
【讨论】: