简体   繁体   English

将Wordpress网站从托管移至本地主机进行开发

[英]Moving wordpress site from hosting to localhost for development

After moving website to my local dev machine, relative links stopped working. 将网站移至我的本地开发机器后,相对链接停止工作。 When i click button with relative link /login, for example, browser redirects to 例如,当我单击带有相对链接/登录的按钮时,浏览器将重定向到

https://localhost/login/ https://开头本地主机/登录/

and shows 并显示

Code: Not Found 代码:未找到

The requested URL /index.php was not found on this server. 在此服务器上找不到请求的URL /index.php。

While it should have redirected to https://localhost/сс/login/ 虽然它应该已经重定向到https:// localhost /сс/ login /

.htaccess contents on localhost : 本地主机上的.htaccess内容:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /cc/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /cc/index.php [L]
</IfModule>
  1. Website files are in var/lib/html/cc folder. 网站文件位于var / lib / html / cc文件夹中。
  2. SiteURL and HomeUrl are both equal to http://localhost/сс SiteURLHomeUrl都等于http:// localhost /сс
  3. Parmalinks setting http://localhost/cc/sample-post/ is used, so no problem with navigating to pages. 使用Parmalinks设置http:// localhost / cc / sample-post / ,所以导航到页面没有问题。

How to fix this issue? 如何解决这个问题?

Tried different .htaccess modifications, moving index.php to /var/lib Nothing helps. 尝试了不同的.htaccess修改,将index.php移至/ var / lib没有任何帮助。

just use WP Migrate DB plugin for database export , it will change all link to your desire link and use this database export file in live site 只需使用WP Migrate DB插件进行数据库导出,它将所有链接更改为您想要的链接,并在实时站点中使用此数据库导出文件

Link ( https://wordpress.org/plugins/wp-migrate-db/ ) 链接( https://wordpress.org/plugins/wp-migrate-db/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM