How to remove ? m=1 or ?m=0 from blogger post URL
Remove ?m=1 From Blogger Post URL
A common question that every blogger searches for is how to remove ?m=1 or ?m=0 from Blogger post URLs. We all know that "simplicity is beauty" and you want a clean permalink. This guide will help you remove these parameters and create professional, clean URLs for your blog posts.
Why Remove ?m=1?
The ?m=1 parameter appears when users access your blog from mobile devices. Removing it provides several benefits.
- • Professional Permalink: Gives your blog posts cleaner, more professional URLs
- • Better SEO: Helps improve ranking in Search Engine Result Pages
- • Shorter URLs: Makes your blog post URLs shorter and easier to share
- • User Experience: Cleaner URLs look more trustworthy and professional
Step-by-Step Tutorial
Follow these simple steps to remove ?m=1 from your Blogger post URLs:
Step 1: Login to Blogger Dashboard
First, log in to your Blogger dashboard and select your blog.
Step 2: Navigate to Theme Section
Click on the Theme option in your Blogger dashboard.
Step 3: Click on Customize
Click on the Customise button to access theme settings.
Step 4: Access Edit HTML
Click on Edit HTML option to modify your theme code.
Step 5: Find the </head> Tag
Press (CTRL + F) from your keyboard and type /head to find the closing head tag.
Step 6: Add the Code
Paste the below code just above the </head> tag.
<script type='text/javascript'>
//<![CDATA[
var uri = window.location.toString();
if (uri.indexOf("%3D","%3D") > 0) {
var clean_uri = uri.substring(0, uri.indexOf("%3D"));
window.history.replaceState({}, document.title, clean_uri);
}
var uri = window.location.toString();
if (uri.indexOf("%3D%3D","%3D%3D") > 0) {
var clean_uri = uri.substring(0, uri.indexOf("%3D%3D"));
window.history.replaceState({}, document.title, clean_uri);
}
var uri = window.location.toString();
if (uri.indexOf("&m=1","&m=1") > 0) {
var clean_uri = uri.substring(0, uri.indexOf("&m=1"));
window.history.replaceState({}, document.title, clean_uri);
}
var uri = window.location.toString();
if (uri.indexOf("?m=1","?m=1") > 0) {
var clean_uri = uri.substring(0, uri.indexOf("?m=1"));
window.history.replaceState({}, document.title, clean_uri);
}
//]]>
</script>
Step 7: Save Settings
Finally, click on the Save icon to save your settings and code.
How the Code Works
The JavaScript code works by:
- Getting the current URL using
window.location.toString() - Checking if the URL contains various encoded or unencoded versions of
m=1 - Extracting the clean URL by removing the unwanted parameters
- Using
window.history.replaceState()to update the URL without reloading the page
Code Breakdown
URL Encoding Handling
The code handles both encoded %3D and unencoded = versions.
Multiple Parameter Checks
Checks for ?m=1, &m=1, and their encoded forms.
No Page Reload
Uses replaceState() instead of pushState() to avoid adding to browser history.
Just save and go to mobile and check the permalink/URL of your Blogger post. You will see that ?m=1 or ?m=0 has been removed. Now enjoy clean, professional URLs! Happy Blogging! :)
Summary
Removing the ?m=1 parameter from Blogger URLs is a simple but effective way to improve your blog's professionalism and SEO. The JavaScript solution provided here works seamlessly across all devices and automatically cleans URLs without requiring any additional configuration.
The code is safe, lightweight, and doesn't affect your blog's performance or functionality. It simply removes the unwanted parameters from the URL when users visit your blog from mobile devices.
Recommended Posts
Join the discussion
Comments
medical billing
PHP website development