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.

Read more here: Moving wordpress site from hosting to localhost for development


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: