简体   繁体   中英

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/

and shows

Code: Not Found

The requested URL /index.php was not found on this server.

While it should have redirected to https://localhost/сс/login/

.htaccess contents on localhost :

# 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.
  2. SiteURL and HomeUrl are both equal to http://localhost/сс
  3. Parmalinks setting http://localhost/cc/sample-post/ is used, so no problem with navigating to pages.

How to fix this issue?

Tried different .htaccess modifications, moving index.php to /var/lib Nothing helps.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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