Latest update seems to have broken links

Issue Summary

After updating to latest version, local links seems to have broken. Upon inspection, it appears the links are broken because the trailing slash on the domain is missing.

Example:
http://localhost:10003mypage
vs.
http://localhost:10003/mypage

for all internal links, the slash after the domain is missing, causing them to break.

Troubleshooting Questions

  • Does this happen for all sites in Local, or just one in particular?
    All sites

  • Are you able to create a new, plain WordPress site in Local and access it in a Browser?
    Yes, this is working correctly.

Replication

Describe the steps that others can take to replicate this issue. If you have screenshots that can help clarify what is happening, please include them!

System Details

  • Which version of Local is being used?
    5.9.3+5100

  • What Operating System (OS) and OS version is being used?

    • macOS Catalina 10.15.7
  • Attach the Local Log. See this Community Forum post for instructions on how to do so:

Hey @453twgreg, Welcome to the Local Community Forums!

I’m having trouble replicating this on my end. I tried creating a new site while using the localhost router mode. From there I create a custom menu within the WP admin, with a couple of child menu items.

Using the default TwentyTwenty theme, everything appears to be working correctly. Have you tried exporting the site and re-importing it into Local?

Another thing to explore is how those menu items are being generated. Is this a custom theme, or in some way using a custom Walker class?

@ben.turner I can’t speak for the original poster, but I am also experiencing this issue.

For me, it seems to happen only when pulling down sites that use the Divi theme. I have not had the issue occur when using a custom theme that uses a custom Walker class.

I created a post here about it before seeing this post. This was not an issue for me prior to installing the latest update.

Any help resolving this issue would be appreciated. Thank you.

When I pull a site down that has Divi installed, some of the assets (images, videos, etc) are broken. Not all assets are broken, but the majority are, including the logo image. I found that the file paths are incorrect, due to a single missing forward slash.

For example, on my local, the slash is missing between .local and wp-content folder:
https://site-name.localwp-content/uploads/2021/01/logo.png

The live site path:
https://www.site-name.com/wp-content/uploads/2021/01/logo.png

The images are not broken on the live sites, and I can’t figure out why the slash isn’t included on local sites. I am using the latest version of Local. Any help would be appreciated! Thanks.

Thanks for pinging me, I’ve merged your topic with this one so that we can keep the related information together!

You mention that this wasn’t an issue until the recent update – do you remember which version of Local you updated from?

It’s interesting that the remote site’s domain has www but the local one doesn’t. I wouldn’t think that would cause issues, but maybe? Can you see if both those versions of the domain are present in the database? I think you can get that info by right-clicking on the site and issuing:

wp db search 'site-name.local'

Also, since this sounds like Divi may be related, have you poked around in the Divi settings to see if doing something like flushing the cache helps?

One other thing to try – since this seems related to WordPress’ routing layer, can you try flushing the permalinks by navigating to “Settings > Permalinks” and click the “Save Changes” button?

Thanks for your quick reply! I don’t recall which version number I had prior, but I always update when I get the update notice. I assume it was the release prior to the latest one.

I have pulled down a variety of sites, and this issue happens whether the site on the server has www or not. There are no instances of the www domain in the database, only the local domain.

I have checked all the Divi settings, cleared all Divi caches, etc. I also checked the live site settings, and everything is as it should be. The trailing slash just seems to disappear when it’s pulled down in Local, and I have no idea why.

I tried saving Permalinks, but it did not change anything or solve the issue.

I want to also note that my co-worker is having the same issue. He is on Mac OS, so this is not just a Windows issue.

Thanks!

@ben.turner Another update:

When I do wp db search 'site-name.local', it returns nothing.

When I do wp search-replace 'site-name.localwp-content' 'site-name.local/wp-content', it returns “Success: Made 0 replacements.”

So when I checked if the domain was present in the database, I did not get a real result, as it only returns 0 or doesn’t return anything at all.

That’s really odd that the Local site’s domain isn’t in the database.

I wonder if the domain is actually in the DB. What do you see when you run:

wp option get siteurl

Since you didn’t see anything when searching the DB, I’m guessing this will return something unexpected.

Do you have any caching plugins installed for the site – I wonder if there’s a setting that’s being stored within the wp-content folder?

This is interesting. When I run wp option get siteurl, it returns https://site-name.local.

I have WP Rocket installed, but it is not activated. It was not activated when I pulled the site down either.

I see that the url is using HTTPS – Have you been able to isolate this to being only an issue with Divi – for example, if you change to a default theme, does the URL resolve itself?

I have seen issues when “force https” plugins are used because they can try and change the URL before the actual server software (nginx/apache) get’s a chance to fully resolve the URL.

Also, does this only happen after using Connect? If you create a new, plain WordPress site and install Divi, does the URL get mangled as well?

We only use Divi or our own custom theme, so I cannot say if other themes have the issue. I have confirmed that when I pull down a site that uses our custom theme, the asset paths are correct. I have tried changing the Divi theme back to the default theme, but it does not resolve the issue.

There are no plugins installed to force https. We just have WordPress Address (URL) and Site Address (URL) set to https in Settings > General.

This only happens when using Connect, or pulling from WP Engine. If I create a new site and then install Divi after the fact, the asset paths are not missing the slash. It only happens when I pull down an existing site that already has Divi installed.

I also tried to downgrade back to an older version of Local. I then pulled a Divi site down, but the issue persisted.

@ben.turner Since there has not been fix and I was unable to use WP-CLI to do a find and replace, I ended up using the WP Migrate DB plugin.

Fortunately, it was successful and I was able to see the missing assets. However, I now get an error message in Local.

This will work for me in the meantime, but I still hope the issue can be figured out and fixed!

1 Like

I had the same issue importing a website into Local v5.10.1. I downgraded to v5.7.2 and all links worked fine.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.