What is the problem
When a Custom Redirect (example www.stylifyyourblog.com/contact ) is opened in a Mobile browser , it leads to a Redirect Loop (See Screenshot below) which doesn't allow the visitor to open the blog. This becomes a big problem when the redirect is used on the homepage of the blog (example YourBlogName.blogspot.com or a custom domain like https://www.stylifyyourblog.com/ ) which makes it impossible for the user to even visit the blog.
Why this happens
The main reason for this problem occurring is the mobile parameter that Blogger adds from the server side. The m=1 parameter interferes with the custom redirect and breaks the whole functionality (As you can see in the short GIF Below). Until last year if a custom redirect with mobile parameter was entered in a normal web browser (example stylifyyourblog.com/contact?m=1 ) it would lead to a 404 page , but this error was fixed by Blogger Team.
How to Solve this Problem
As the custom Redirect feature doesn't work universally , you can always use good old JavaScript for this. Firstly I would suggest to remove the specific redirect from Settings > Search Preferences > Errors and redirections > Custom Redirects . Then go to Template > Edit HTML and search for <head> tag and add the following code just below it (Backup your template before doing this)
For example sake , I am assuming we want to redirect https://www.stylifyyourblog.com/templates to https://www.stylifyyourblog.com/search/label/Template
<script> if(window.location.href == 'https://www.stylifyyourblog.com/templates?m=1' || window.location.href == 'https://www.stylifyyourblog.com/templates' ) { window.location="https://www.stylifyyourblog.com/search/label/Template"; } </script>
As you can make out , this is just tests if the current URL is the normal or mobile version of the URL you want to redirect , if it matches then it redirects to the URL of your choice. This works in Desktop and Mobile browsers just fine ( See Youtube video below )
What is Blogger doing about it
If you want to redirect a large number of pages , then it will become unmanageable and confusing to keep adding new snippets of code to the template. This work is best done by Blogger at the Server side. As of now this issue has been escalated to the Blogger Team and they are looking into it . Hope they will fix this issue soon
If you are currently having problems with Blogger , feel free to share them in the comments , I will try to help out to my best of abilities
Thanks for the heads-up!
I still cannot get this to work, but maybe I'm missing something. I want my address http://www.mrachelletester2.blogspot.com to redirect to http://www.mrachelletester2.blogspot.com/p/blog-page.html
I pasted the above code under the head tag, and replaced the addresses with mine.
Am I missing something or putting it in the wrong place?
Thank you!
Hi McKenna Olson
I didn't take into account the ccTLD's before , try out this code
<b:if cond='data:blog.url == "http://www.mrachelletester2.blogspot.com/"'>
<script>
if(window.location.href == '<data:blog.url/>?m=1' || window.location.href == '<data:blog.url/>' )
{
window.location="http://www.mrachelletester2.blogspot.com/p/blog-page.html";
}
</script>
</b:if>
It's taken forever for me to reply to this, but THANK YOU a million times over!
THANKS SO MUCH !!!!!
Thank you a lot!!
Thanks for this, I've been trying to get around this for ages! :)
ooh, I thought it worked for me, it is now showing my website on mobile view but it is also showing my blog now when I was trying to hide it i.e. I was trying to redirect www.jenmsmith.com to http://www.jenmsmith.com/p/life-coaching.html - any help appreciated!
Hi I tried using the code you gave to Mc Kena but this parts appears in red
#39;?m=1' || window.location.href == '' )
so it's not working :S! HELP
Thanks a lot! It really helped me.
thank you!
hi #Prayag Verma i do as you step and paste below head, but still not change.. can u help me?.. I want my view blog in Mobile same with Desktop view when i open in android. My blog is buatkuihraya.blogspot.com i tried a lot style and various of source but still not change. When i open my blog in android my sidebar widget and header was missing, after i using code html mobile= 'yes' if have apppear but just appear in my footer side when i saw in android. I hope u can help me.. Thank you.. buatkuihraya.blogspot.com
Tried it a million times and it didn't work for me. :(
It works! Thank you so much for this!!!
I recently started a new website for my business and was facing the same problem. I tried to redirect my domain http://earendilexports.com to http://www.earendilexports.com/p/welcome.html.
I've followed the technique you suggested in the above post however it's redirecting only on the desktop version of theb site and not the mobile version.
The code #39;?m=1' || window.location.href == '') appeares in red.
Please let me know how to fix it. Any help would be great
Thanks!! my problem solved when i change from default redirect that the blogger offers and use this code instead. Thanks again!!
This solution works great for me - I just had a couple of issues when using this:
In my application I wanted to use the redirect to be used to point to a 'fake homepage' for my blogger, however I also wanted people to be able to view my blog as normal. To workaround this I labelled all my blogposts with an arbitrary identical label and just set up a search for that label so users could view all my blog posts with that label.
The second thing to be wary of is regarding the if statement, remember that the URL you wish to redirect from may have a "/" on the end of it even if it doesn't always show in your browsers address bar. :)
Thanks for the help Prayag!!
Tried this for my blogger BinaRealm redirecting http://binarealm.blogspot.com/p/binarealm.html to http://binarealm.com/ and it works
But the mobile site does not show the static homepage.... A list of all my posts is shown instead.... Can I redirect mobile users to a static mobile-site homepage for my blog??
Very Good Tips Thanks a lot for sharing with us....
It hasn't worked for me.
The page never gets loaded.
Thank you. The second version of the amended code worked for us. That's a very handy fix!
Hello, Thanks for the advice. I now understand why the problem occurs.
When I paste in the code, it works on the mobile site, but them creates a problem for the main site. It just flashes up with a '1' and creates a loop...
Any thoughts?
i tried but not solved...........................
Thanks for sharing wonderful information.
i got alot of informaton form your blog thanks
http://sheharzaad.blogspot.com/
I have a beginner question, do you need a rel canonical to tell google of the existance of your mobile site if the mobile site is placed in a subfolder of the main site ?
thanks
http://pricelistbd57.blogspot.com/