Ecommerce Shopify WordPress Discussion

Google Indexing & Re-directs – Issue with mobile page redirects

I've currently got a basic wordpress website that I'm having Indexing trouble with. Due to an API i'm using on it I have a desktop version but also a mobile version - the responsive desktop version doesn't work well at all on mobile devices which is why I set up two different versions.. This is probably my first mistake. The mobile page is just a single page though. I've set up some php that redirects any of the desktop pages to the mobile page if it detects a mobile device. If you're viewing from a desktop, it will remain on the desktop version - this is what it's doing below. Google indexing doesn't like this at all and has only indexed the main landing page. The mobile page and all the other sub pages aren't indexed due to the following; Duplicate, Google chose different canonical than user - on the mobile page Page with redirect - on all my sub pages Does anyone have a smart solution or any ideas to handle something like this? Cheers function wpcb_redirect_to_mobile() { if ( wp_is_mobile() && (is_page( 'website' ) || is_page() ) ) { if ( ! is_page( 'mobile' ) ) { // Avoid redirect loop wp_redirect( 'https://www.website.com/mobile/' ); exit(); } } elseif ( wp_is_mobile() && get_post_ancestors( get_the_ID() )[0] === get_page_by_path( 'website' )->ID ) { global $post; $ancestors = get_post_ancestors( $post ); $redirect_url = 'https://www.website.com/mobile/'; foreach ( $ancestors as $ancestor ) { $redirect_url .= get_post_field( 'post_name', $ancestor ) . '/'; } $redirect_url .= $post->post_name . '/'; if ( ! is_page( 'mobile' ) ) { // Avoid redirect loop wp_redirect( $redirect_url ); exit(); } } } add_action( 'template_redirect', 'wpcb_redirect_to_mobile' ); Not tried anything yet
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.