简体   繁体   中英

Why is my Wordpress RSS feed showing IP address and post ID, rather than full URL?

For my Wordpress website at example.com/feed/ I noticed my RSS is showing the IP address and using post ID, rather than showing the actual URL. It's also showing http instead of https. Is this a cache issue? I can't figure out why, or how to fix. Currently, RSS feed shows this for page link to content:

<guid isPermaLink="false">http://44.78.4.233/?p=3993</guid>

instead of

<guid>https://www.example.com/my-post/</guid>

I noticed this problem after noticing Google Search Console was showing a ton of internal page links which don't even exist, and all using the IP address. Not sure if this is related to my feed or not.

When I first set up the site, I was using the IP, before pointing domain. Google must have crawled it before I even added it to Console. Last crawl was Jan 14 which is just before I pointed domain. Here is my .htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^44\.78\.4\.233$
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
</IfModule>

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Options -Indexes

Site works fine. Redirects all traffic to preferred https. Also redirects IP to https. No errors on W3C validator. Also added all versions of site to Google console and verified, and set preferred version as https://www . Also submitted sitemap URL https://www.example.com/sitemap_index.xml which is generated from Yoast plugin. I checked the sitemap and it looks good.

Tried rebuilding permalinks. Didn't fix the RSS feed problem which still shows IP and post ID. Perplexed.

WordPress permalinks are intended to be unique. They don't change, even if you change the preferred domain. New values use the preferred domain, but old values will keep the original values unless you manually edit the values. You can manually edit the wp_posts table to update the guid using the new value with the domain and you'll be back on track.

You can use the following to replace the protocol and IP with the new protocol and domain in all entries with your favorite SQL editor:

UPDATE `wp_posts` SET `guid`=replace(`guid`,'http://1.1.1.1/','https://example.com/');

This doesn't rebuild the path portion, though. You can do that for the root elements (as long as you haven't changed anything from the defaults) with this one ( caveat emptor ):

UPDATE `wp_posts` SET `guid`=replace(`guid`,'http://1.1.1.1/','https://example.com/' + `post_name`) WHERE (`post_parent`=0 AND `post_type` IN ('post','page'));

This updates the guid to use the new protocol, domain, and the current post_name value for all post & page types that do not have a parent ( post_parent =0). Be aware that the URLs to child posts/pages and custom permalink slugs will still cause problems for you, and will require close attention in order to ensure that they're reconstructed correctly.

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