How to Remove ?m=1 from Blogger for Better SEO in 3 Steps

Learn how to remove ?m=1 from Blogger URLs in 3 easy steps to improve SEO and performance. Use JavaScript or Cloudflare for clean URLs!

Blogger automatically appends ?m=1 to URLs when accessed from mobile devices, signaling a mobile-friendly version. While this was useful for older, non-responsive themes, it can clutter URLs, potentially confuse users, and create duplicate content issues for SEO. In this guide, we’ll show you how to remove ?m=1 permanently using JavaScript or Cloudflare Workers and Routes to improve your site’s SEO and enhance user experience. I’ve successfully implemented these methods on multiple Blogger sites, achieving cleaner URLs and better search engine indexing.

Why Remove ?m=1 from Blogger URLs?

A Simple Definition

The ?m=1 parameter is added by Blogger to indicate a mobile-optimized page, while ?m=0 denotes the desktop version. This legacy feature helped older themes serve separate layouts for mobile and desktop users.

Examples of the Issue

  • Example 1: Your blog post URL is https://yourblog.com/2025/07/sample-post.html on desktop but becomes https://yourblog.com/2025/07/sample-post.html?m=1 on mobile, creating two URLs for the same content.
  • Example 2: Google Search Console reports “Duplicate, submitted URL not selected as canonical” for mobile URLs, diluting your SEO efforts.

Removing ?m=1 ensures cleaner, unified URLs, which can improve your site’s SEO by avoiding duplicate content and enhance user experience with professional-looking links. Let’s dive into the three methods to achieve this.

Three Steps to Remove ?m=1 from Blogger URLs

Below are three effective methods: one using JavaScript for simplicity and two using Cloudflare for advanced users with custom domains. Note that Cloudflare methods require a custom domain (not .blogspot.com) and DNS managed by Cloudflare with proxy enabled. Be aware of Cloudflare’s free tier limitations: limited daily requests (100,000 for Workers) and potential downtime if exceeded.

Step 1: Remove ?m=1 Using JavaScript

Overview

This method uses JavaScript to hide ?m=1 in the browser’s address bar without affecting page content, ideal for users without Cloudflare or those seeking a quick fix.

Details

  1. Log in to your Blogger Dashboard.
  2. Navigate to Theme > Edit HTML.
  3. Locate the <head> tag using Ctrl+F.
  4. Paste the following JavaScript code just below the <head> tag:
    <script>
    var uri = window.location.toString();
    if (uri.indexOf("?m=1") > 0) {
        var clean_uri = uri.substring(0, uri.indexOf("?m=1"));
        window.history.replaceState({}, document.title, clean_uri);
    }
    </script>
  5. Click Save Theme.
How It Works

The script checks if ?m=1 exists in the URL and removes it from the address bar using the History API, keeping the page content intact. It’s client-side, so it doesn’t affect server-side rendering but provides a cleaner URL for users.

Note: This method only visually hides ?m=1. Search engines may still index the mobile URL unless canonical tags are set (e.g., <link rel="canonical" href="https://yourblog.com/sample-post">). Test in browsers like Chrome and Firefox, as some (e.g., Opera) may not support this script.

Transition: If you’re using a custom domain with Cloudflare, the next two methods offer server-side solutions for more robust results.

Step 2: Remove ?m=1 Using Cloudflare Workers

Overview

Cloudflare Workers act as middleware to modify responses before they reach users, allowing you to remove ?m=1 permanently by detecting device types and rewriting URLs server-side.

Details

  1. Log in to your Cloudflare Dashboard.
  2. Go to Workers & Pages > Create Application > Workers > Create Worker.
  3. Name your Worker (e.g., remove-m1-worker) and deploy the default script.
  4. Click Edit Code and replace the default script with:
    addEventListener('fetch', event => {
        event.respondWith(handleRequest(event.request));
    });
    
    async function handleRequest(request) {
        const url = new URL(request.url);
        const userAgent = request.headers.get('user-agent') || '';
        const MOBILE_REGEX = /(?:phone|windows\s+phone|ipod|blackberry|(?:android|bb\d+|meego|silk|googlebot)\s.+?\smobile|palm|windows\s+ce|opera\ mini|avantgo|mobilesafari|docomo|KAIOS)/i;
    
        if (MOBILE_REGEX.test(userAgent) && url.searchParams.get('m') === '1') {
            url.searchParams.delete('m');
            return Response.redirect(url.toString(), 301);
        }
        return fetch(request);
    }
  5. Save and deploy the Worker.
  6. Go to Websites > Your Domain > Workers Routes > Add Route.
  7. Set the route to https://yourdomain.com/* and select your Worker.

Example: If a mobile user visits https://yourdomain.com/post?m=1, the Worker detects the mobile User-Agent, removes ?m=1, and redirects to https://yourdomain.com/post with a 301 status, signaling search engines to index the clean URL.

Warning: Blogger doesn’t officially support Cloudflare integration, so test thoroughly. Ensure your site remains accessible and responsive. Exceeding Cloudflare’s free tier limits (100,000 requests/day) may cause downtime.

Transition: For a simpler Cloudflare approach, the next method uses URL Rewrite Rules.

Step 3: Remove ?m=1 Using Cloudflare Workers Routes

Overview

Cloudflare’s URL Rewrite Rules modify incoming requests to remove ?m=1 without needing extensive coding, making it easier for non-technical users.

Details

  1. Log in to your Cloudflare Dashboard.
  2. Navigate to Websites > Your Domain > Rules > URL Rewrite Rules > Create Rule.
  3. Name the rule (e.g., Rewrite Blogger URLs).
  4. Under “If incoming requests match,” select Custom filter expression.
  5. Click Edit Expression and enter:
    (http.host eq "yourdomain.com" and http.request.uri.query contains "m=1")
    Replace yourdomain.com with your actual domain.
  6. Set the action to Rewrite URL, enable “Preserve query string,” and set the query to:
    m=0
  7. Save and deploy the rule.

Example: A request to https://yourdomain.com/post?m=1 is rewritten to https://yourdomain.com/post?m=0, ensuring search engines and users see a consistent URL. This method is less flexible than Workers but simpler to implement.

Info: This method relies on Cloudflare’s proxy and may not work perfectly for all User-Agents. Test across devices to ensure compatibility.

Conclusion

This guide provides three proven methods to remove ?m=1 from Blogger URLs, helping you improve your site’s SEO and create a professional user experience. Whether you choose the simplicity of JavaScript or the power of Cloudflare Workers and Routes, cleaner URLs can reduce duplicate content issues and enhance indexing. Regularly monitor your site’s performance in Google Search Console to ensure proper indexing and user satisfaction. Take action now: implement one of these methods, test your URLs, and share your results in the comments below!

“Clean URLs not only look professional but also signal to search engines that your site is well-optimized.” – SEO Expert

https://yourblog.com/remove-m1-blogger-seo