2

I have migrated from Joomla to WordPress and after migration I understood my relative URLs like /abc has changed to abc (the / is omitted.)

So if I am on page example.com/efg, my relative link seems to be example.com/efg/abc because / is omitted from my address.

The point is that when I click on abc link in efg page, it goes to correct URL meaning example.com/abc and not example.com/efg/abc

1.Is it necessary to update my database and add / in the beginning of addresses? 2. Do relative addresses (without /) have negative effects on SEO? According to this article do you advise to convert all my relative path to absolute path? (I have set my redirection of www and http correctly and site would be always with ssl)

2 Answers 2

4

If the links work correctly, there is no need to change them. Search engines can deal with relative links that start with a slash, as well as ones that don't. It won't hurt your SEO that your links are different than they used to be.

As to why your links work without a slash. There are actually several types of links:

  • Absolute links: The have the full protocol and site. Eg. https://example.com/abc This type of link will point to the correct page, no matter what page it is linked from.
  • Protocol relative links: They have the site, but use the protocol from the context. The start with a double slash. Eg //example.com/abc This type of link may end up on either https://example.com/abc or http://example.com/abc depending on whether it was linked from a HTTPS site or not.
  • Root relative links: They don't have the protocol or the site and start with a single slash. Eg. /abc. Thes links get appended to the protocol and domain name from the current context. So this link will always end up on https://example.com/abc no matter where on the https://example.com website it is linked.
  • Document relative links: Don't start with a slash. Eg abc. This type of link is relative to the last slash from the current URL. So if this link is on https://example.com/efg it will point to http://example.com/abc however if it is on http://example.com/efg/foo it will point to https://example.com/efg/abc.

On a site where URLs have deep directory structures, I usually recommend using root relative links. However in your case where the links are on pages that are in the site root; root relative, and document relative links are equivalent.

0
4

Stephen has some good explanation of the types of links, but let me add some more information that may help answer your question.

Edited response

Affect on SEO

After reading your article source, I don't think the article you reference has anything to do with your migration. The article is more about should I use absolute or should I use relative URLs? At the conclusion of the article it states:

From an SEO point of view, the most important thing is that the URL points to the correct point on the server.

There is no perfect solution to which URLs to use on the site. Both relative and absolute paths have pros and cons. Relative paths make the developer’s job easier and faster.

I also think this article is probably more important for those who write raw html files rather than those who use tools like WP. People who code raw html are faced with this question every time they write code. I've never thought about it once in the 5 years I've used WP, but always thought about it when I was writing code with a text editor. (I can't speak for Joomla as I've never used it.)

How WP writes URLs and its impact on migration from staging to production

As I mentioned in a previous edit, WP writes all URLs as an absolute URL in the final page (assuming your didn't write the URL in the text editor). However, it pulls these URLs from the database and adjusts the host to match the host set in the WP configuration, which is helpful when moving from staging to production. I.e, dev.example.com to www.example.com. There are also tools to help migrate WP content between two hosts.

Content stealing

There are also several plugins and themes in WP that will automatically create canonical links preventing the theft of content the article refers to. This eliminates one argument for not using relative URLs IMO. If you don't want to use a plugin, you can always code it in your child theme.

What to do if you're worried about 404 errors due to migration

I would suggest you look at a tool that will scan your entire website for internal 404 errors. Screaming Frog and others can do this for you. Using the results, look to see if the migration caused any broken URLs. Then you can decide if you really need to take the time (and risk) to modify your existing URLs.

3
  • +1 I agree with you on content stealing. If someone still does steal the content, fantastic! A cross domain canonical is just as powerful (if not more in some cases) than a link. Assuming your page is crawled and indexed before the thief's, of course. Nov 16, 2021 at 17:44
  • @MikeCiffone, curious if timing of the crawl makes a difference if there's a canonical. I would hope that Google would likely to go to source of canonical like it would any other link discovery. I'm also guessing content stealing has gotten complex enough to copy between the <body> tags and ignore the other content.
    – Trebor
    Nov 16, 2021 at 22:47
  • Dear Trebor, thanks so much for the useful information you sent. I will use one of those plugins to check 404 errors. I was also worried about my relative urls and was thinking to change them to absolute ones.
    – Sarah
    Nov 17, 2021 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.