Epic 404 on listings
This topic contains 28 replies, has 3 voices, and was last updated by Stiofan O’Connor 8 years, 3 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
July 26, 2017 at 8:59 pm #388623This reply has been marked as private.July 27, 2017 at 6:00 pm #388715
Hi Paolo,
have you had a chance to have a look please?
Best regards,
PatJuly 27, 2017 at 6:26 pm #388725This reply has been marked as private.July 27, 2017 at 6:29 pm #388727Hi Stiofan,
Thanks for resolving the country thingy
i enabled category in url but then google still gives them without the category in it…
maybe i need to do a 301 redirect (how?)? or do you have a more permanent idea? i need to get that fixed even if i switch to default country, selected regions and selected cities?
What do you think?
PatJuly 27, 2017 at 6:35 pm #388731The 2 that weren’t working yesterday are working now:
https://www.toutwaterloo.be/listing/belgium/wallonie/lasne/restaurants/kaiyou-restaurant-1/
https://www.toutwaterloo.be/listing/belgium/wallonie/waterloo/menunextdoor/claudia-nathalie-1/
It’s possible that you added listings after changing permalink structure and Google Indexed them with that structure. In that case it’ll be very difficult to write a script to redirect them all correctly.
That’s why the permalink structure should be set before allowing Google to scrape your pages.
Can you gather a list of the listing that are not working now?
Let us know,
July 27, 2017 at 6:36 pm #388732“i enabled category in url but then google still gives them without the category in it”
The ones i checked from this search https://wpgeodirectory.com/support/topic/epic-404-on-listings/#post-388616
Now work, so i gess google has a mix and mash of some with and some without, just pick one and stick with it.
Check if there are many links google has to broken urls, you might have to do some redirects.
Stiofan
July 27, 2017 at 6:40 pm #388734yes and yes, in fact i did all in the same time, thinking that google would crawl again if i change something but it does not seem to happen
now do i have to provide a new sitemap or something?
if a redirect is needed how do i do that?
is there a way to validate all places as working links without browsing 3600 url’s?
Thanks for your help,
PatJuly 28, 2017 at 9:45 am #388793if it were me..
I would write a wee snippet that only ran on the 404 page, it would grab the last slug and check if its a real post and if so redirect to the proper url.
Stiofan
July 28, 2017 at 9:47 am #388794Hi Stiofan,
how would this code be looking please?
Thanks,
PatJuly 28, 2017 at 10:31 am #388805Hi Pat,
function _my_fix_listings_404s(){ if( is_404() ){ $url = $_SERVER['REQUEST_URI']; $slug = basename($url); global $wpdb; $post_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type IN ('gd_place','gd_event') AND post_status = 'publish' AND post_name = %s", $slug)); if(!empty($post_id)){ wp_safe_redirect( esc_url( get_permalink( $post_id) ), 301 ); exit; } } } add_action( 'template_redirect', '_my_fix_listings_404s' );Stiofan
July 28, 2017 at 10:49 am #388808This reply has been marked as private.July 28, 2017 at 11:14 am #388812I updated my code here and also on your site.
In this case its not working because its looking for “mixto-restaurant” but the actual url is “mixto-restaurant-1”
If this is wide spread we could try altering the query a bit but if its just that listing then its not really worth it.
Stiofan
July 28, 2017 at 11:30 am #388814Shall we leave it like this for 24-48hrs to see how it goes?
July 28, 2017 at 12:03 pm #388821yeah give it a try.
Stiofan
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket