Relative links broken after migrating staging to development in WordPress websit
-
Trying to migrate WordPress *staging* website hosted on some hosting provider to local computer and having issues with relative urls.
Migration steps:
1) Cloned site code repository
2) Imported mysql dump
3) Used wp-cli to search and replace staging site url with
*localhost/site*Everything seems fine apart from some relative urls.
Example of issues:
Correct linking
Sub menu Travel links to page Travel (whose slug is travel), so clicking it redirects to the correct path siteurl/travel.
Where siteurl is localhost/site hosted in /var/www/html/site.Incorrect linking
The widget area image link */travel* somehow links to the wrong path localhost/travel.
Its Settings->;General->;WordPress Address (URL) and Site Address (URL) are: localhost/siteI think it’s related somehow to .htaccess file or apache server configuration.
Localhost site .htaccess file contents are:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /site RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /site/index.php [L] </IfModule>
Generally, my question, what apache server configuration is needed to replicate the behaviour of relative links on hosting? So that relative links on the website like /link would be relative to the wordpress site url (localhost/site/link) and not relative to host – localhost/link.
- The topic ‘Relative links broken after migrating staging to development in WordPress websit’ is closed to new replies.