Skip to content
    Moz logo Menu open Menu close
    • Products
      • Moz Pro
      • Moz Pro Home
      • Moz Local
      • Moz Local Home
      • STAT
      • Moz API
      • Moz API Home
      • Compare SEO Products
      • Moz Data
    • Free SEO Tools
      • Domain Analysis
      • Keyword Explorer
      • Link Explorer
      • Competitive Research
      • MozBar
      • More Free SEO Tools
    • Learn SEO
      • Beginner's Guide to SEO
      • SEO Learning Center
      • Moz Academy
      • SEO Q&A
      • Webinars, Whitepapers, & Guides
    • Blog
    • Why Moz
      • Agency Solutions
      • Enterprise Solutions
      • Small Business Solutions
      • Case Studies
      • The Moz Story
      • New Releases
    • Log in
    • Log out
    • Products
      • Moz Pro

        Your all-in-one suite of SEO essentials.

      • Moz Local

        Raise your local SEO visibility with complete local SEO management.

      • STAT

        SERP tracking and analytics for enterprise SEO experts.

      • Moz API

        Power your SEO with our index of over 44 trillion links.

      • Compare SEO Products

        See which Moz SEO solution best meets your business needs.

      • Moz Data

        Power your SEO strategy & AI models with custom data solutions.

      NEW Keyword Suggestions by Topic
      Moz Pro

      NEW Keyword Suggestions by Topic

      Learn more
    • Free SEO Tools
      • Domain Analysis

        Get top competitive SEO metrics like DA, top pages and more.

      • Keyword Explorer

        Find traffic-driving keywords with our 1.25 billion+ keyword index.

      • Link Explorer

        Explore over 40 trillion links for powerful backlink data.

      • Competitive Research

        Uncover valuable insights on your organic search competitors.

      • MozBar

        See top SEO metrics for free as you browse the web.

      • More Free SEO Tools

        Explore all the free SEO tools Moz has to offer.

      What is your Brand Authority?
      Moz

      What is your Brand Authority?

      Check yours now
    • Learn SEO
      • Beginner's Guide to SEO

        The #1 most popular introduction to SEO, trusted by millions.

      • SEO Learning Center

        Broaden your knowledge with SEO resources for all skill levels.

      • On-Demand Webinars

        Learn modern SEO best practices from industry experts.

      • How-To Guides

        Step-by-step guides to search success from the authority on SEO.

      • Moz Academy

        Upskill and get certified with on-demand courses & certifications.

      • SEO Q&A

        Insights & discussions from an SEO community of 500,000+.

      Unlock flexible pricing & new endpoints
      Moz API

      Unlock flexible pricing & new endpoints

      Find your plan
    • Blog
    • Why Moz
      • Small Business Solutions

        Uncover insights to make smarter marketing decisions in less time.

      • Agency Solutions

        Earn & keep valuable clients with unparalleled data & insights.

      • Enterprise Solutions

        Gain a competitive edge in the ever-changing world of search.

      • The Moz Story

        Moz was the first & remains the most trusted SEO company.

      • Case Studies

        Explore how Moz drives ROI with a proven track record of success.

      • New Releases

        Get the scoop on the latest and greatest from Moz.

      Surface actionable competitive intel
      New Feature

      Surface actionable competitive intel

      Learn More
    • Log in
      • Moz Pro
      • Moz Local
      • Moz Local Dashboard
      • Moz API
      • Moz API Dashboard
      • Moz Academy
    • Avatar
      • Moz Home
      • Notifications
      • Account & Billing
      • Manage Users
      • Community Profile
      • My Q&A
      • My Videos
      • Log Out

    The Moz Q&A Forum

    • Forum
    • Questions
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. Home
    2. SEO Tactics
    3. Intermediate & Advanced SEO
    4. How do you 301 redirect URLs with a hashbang (#!) format? We just lost a ton of pagerank because we thought javascript redirect was the only way! But other sites have been able to do this – examples and details inside

    Moz Q&A is closed.

    After more than 13 years, and tens of thousands of questions, Moz Q&A closed on 12th December 2024. Whilst we’re not completely removing the content - many posts will still be possible to view - we have locked both new posts and new replies. More details here.

    How do you 301 redirect URLs with a hashbang (#!) format? We just lost a ton of pagerank because we thought javascript redirect was the only way! But other sites have been able to do this – examples and details inside

    Intermediate & Advanced SEO
    5
    9
    9769
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with question management privileges can see it.
    • DA2013
      DA2013 Subscriber last edited by

      Hi Moz,

      Here's more info on our problem, and thanks for reading!

      • We’re trying to Create 301 redirects for 44 pages on site.com.
      • We’re having trouble 301 redirecting these pages, possibly because they are AJAX and have hashbangs in the URLs.
      • These are locations pages. The old locations URLs are in the following format: www.site.com/locations/#!new-york and the new URLs that we want to redirect to are in this format: www.site.com/locations/new-york
      • We have not been able to create these redirects using Yoast WordPress SEO plugin v.1.5.3.2.
      • The CMS is WordPress version 3.9.1
      • The reason we want to 301 redirect these pages is because we have created new pages to replace them, and we want to pass pagerank from the old pages to the new. A 301 redirect is the ideal way to pass pagerank.
      • Examples of pages that are able to 301 redirect hashbang URLs include http://www.sherrilltree.com/Saddles#!Saddles and https://twitter.com/#!RobOusbey.
      1 Reply Last reply Reply Quote 0
      • JamesTDG
        JamesTDG last edited by

        The solution I came up with was:

        1. Create a list of all the source URLs you have, and all the destination URLs you want
        2. Create all the destination URL pages
        3. Work out what the Ugly versions of all hashbang (pretty) URLs should be and record them (ref: https://developers.google.com/webmasters/ajax-crawling/docs/specification)
        4. Implement 301 Redirects for the Ugly URLs
        5. Deploy a Sitemap with Pretty URLs
        6. Submit Your Sitemap to Google Webmaster Tools
        7. Wait for Google to re-index all your pages
        8. Check that the new URL(s) show up in Google search results too
        9. Clean up – Remove the pretty URLs from the sitemap

        Job done!

        I created a detailed page on this with examples on my blog at www.thedriversgarage.com/web-technology/redirecting-hashbang-urls-wix-urls/

        Disclaimer - Make your own enquiries and do your own tests.  I'm a pragmatist, I really don't care if this complies to standards.  It worked for me and that's all I cared about.  Google, etc. may process this stuff differently in the future. Do your own tests.

        1 Reply Last reply Reply Quote 0
        • spencerhjustice
          spencerhjustice @DA2013 last edited by

          I would like to point out that twitter is using javascript redirects not serverside redirects. If you disable javascript and try that url it will load the homepage/ your twitter feed and the url will stay the same.

          The second url doesn't seem to be properly redirecting as at least for me it just 301 redirects back to itself.

          1 Reply Last reply Reply Quote 1
          • spencerhjustice
            spencerhjustice @Andy.Drinkwater last edited by

            That's not true. Google is able to crawl and index properly setup ajax based pages like the one in question. Bing on the otherhand is not able to do so or at least not last time I checked.

            1 Reply Last reply Reply Quote 0
            • Andy.Drinkwater
              Andy.Drinkwater @DA2013 last edited by

              That will teach me to skim read 😄

              Perhaps trying a different 301 plugin will help? Alternatively, you can pretty much redirect anything from within .htaccess.

              This page on Webmaster World might be worth reading.

              -Andy

              1 Reply Last reply Reply Quote 1
              • DA2013
                DA2013 Subscriber last edited by

                Thanks for the responses!

                @Kevin: Our main concern here is getting back that lost page rank, since javascript redirects don't pass page rank. We used http://www.internetofficer.com/seo-tool/redirect-check/ and _SEO Tools for Excel _to check whether the hashbang URL examples were using 301 redirects.

                The correct URLs are

                http://twitter.com/#!RobOusbey
                http://www.sherrilltree.com/Saddles/#!Saddles

                @iNetSEO

                These pages were indexed by Google before somehow, I suspect using escaped_fragment? the hashbang URLs would show up in search results

                Andy.Drinkwater spencerhjustice 2 Replies Last reply Reply Quote 0
                • KevinBudzynski
                  KevinBudzynski last edited by

                  With the JavaScript option, people who bookmarked the page will get redirected.

                  1 Reply Last reply Reply Quote 1
                  • Andy.Drinkwater
                    Andy.Drinkwater last edited by

                    The hash tag means that the page wont be indexed by Google and therefore, carry no page rank. It is like it is invisible. Just launch the new pages because Google will have never seen the current ones.

                    -Andy

                    spencerhjustice 1 Reply Last reply Reply Quote 1
                    • KevinBudzynski
                      KevinBudzynski last edited by

                      I may be wrong, but I don't believe you can do this via a 301 redirect. How did you know the examples used a 301 redirect? The examples provided may have used JavaScript to do it (may not be the best, but can't think of any other option).

                      1 Reply Last reply Reply Quote 1
                      • 1 / 1
                      • First post
                        Last post

                      Got a burning SEO question?

                      Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.


                      Start my free trial


                      Browse Questions

                      Explore more categories

                      • Moz Tools

                        Chat with the community about the Moz tools.

                      • SEO Tactics

                        Discuss the SEO process with fellow marketers

                      • Community

                        Discuss industry events, jobs, and news!

                      • Digital Marketing

                        Chat about tactics outside of SEO

                      • Research & Trends

                        Dive into research and trends in the search industry.

                      • Support

                        Connect on product support and feature requests.

                      • See all categories

                      Related Questions

                      • alex_goldman

                        All URLs in the site is 302 redirected to itself

                        Hi everyone, I have a problem with a website wherein all URLs (homepage, inner pages) are 302 redirected. This is based on Screaming Frog crawl. But the weird thing is that they are 302 redirected to themselves which doesn't make any sense. Example:
                        https://www.example.com.au/ is 302 redirected to https://www.example.com.au/ https://www.example.com.au/shop is 302 redirected to https://www.example.com.au/shop https://www.example.com.au/shop/dresses is 302 redirected to https://www.example.com.au/shop/dresses Have you encountered this issue? What did you do to fix it? Would be very glad to hear your responses. Cheers!

                        Intermediate & Advanced SEO | | alex_goldman
                        0
                      • Jonathan.Smith

                        Should I include URLs that are 301'd or only include 200 status URLs in my sitemap.xml?

                        I'm not sure if I should be including old URLs (content) that are being redirected (301) to new URLs (content) in my sitemap.xml. Does anyone know if it is best to include or leave out 301ed URLs in a xml sitemap?

                        Intermediate & Advanced SEO | | Jonathan.Smith
                        0
                      • Colin.Accela

                        Setting up 301 Redirects after acquisition?

                        Hello! The company that I work for has recently acquired two other companies. I was wondering what the best strategy would be as it relates to redirects / authority. Please help! Thanks

                        Intermediate & Advanced SEO | | Colin.Accela
                        0
                      • CoGri

                        301 Redirect from ASP.NET to PHP...Is it possible?

                        Hi all, I'm trying to migrate my current website over to wordpress however my current website is ASP.NET and obviously Wordpress uses PHP. Is it possible to perform a 301 redirect from a asp.net to a php? Or do you need to convert the asp.net language into php? Or something different? I welcome your thoughts? Regards, Thomas Rochford

                        Intermediate & Advanced SEO | | CoGri
                        0
                      • bizzer

                        Changing a parent category and 301 redirecting

                        I have a set of three pages that are subpages of a parent. The structure is as follows: mysite.com/directory/personal-widgets mysite.com/directory/commercial-widgets mysite.com/directory/widgets-services The partent page name "directory" really isn't working for where I want these pages to evolve. So I want to change it to "guides" In a world without worrying about google, I would simply change the parent page to guides, so they look like this, and be done with it: mysite.com/guides/personal-widgets But, the obvious problem is that I have external links to the page now. And the pages have a nice PR. And they also have Facebook page Likes and I don't know if I'll lose those. I know that if I should do this I should redirect the pages to the new pages of course. My question is: Will redirecting the old URL to the new URL with a 301 cause anything negative to happen that I might not be expecting?  Does Google dislike Redirects for any reason, or understand they are sometimes necessary?

                        Intermediate & Advanced SEO | | bizzer
                        0
                      • Prime85

                        301 Redirect - What happens to backlinks

                        Hello... One of my sites is losing rankings in G. I received the webmaster notification of unnatural links... My question is, should i do a 301 redirect of every page on my site to a new domain? If so, do the backlinks (which i believe are causing my rankings to drop) carry over? How about the good backlinks? Also, what would happen to the rankings i currently have on page 1? Thanks

                        Intermediate & Advanced SEO | | Prime85
                        0
                      • kwoolf

                        Trailing Slash: Lost in Redirection?

                        Question here, but first the lead in. As you all know, 301 redirects don't pass on 100% of link juice. I've set up my site using htaccess to redirect all non-ww to www and redirect all URLs to have a trailing slash. FYI, the preferred domain is selected in WMT and canonical URLs appear in the head section of all pages. So now what happens when sites that link to mine don't include either the www or the trailing slash, which is actually quite common? Of course, asking the site own to correct the link is ideal, but that's not always possible. So if thousands of links on external sites are linking to http://www.site.com instead of http://www.site.com/, won't lots of link juice get lost in redirection? I can't think of anything more I can do to the URLs to reduce duplicate content and juice dilution. Thoughts? Kevin

                        Intermediate & Advanced SEO | | kwoolf
                        0
                      • MyNet

                        How To 301 Redirect .html pages

                        I need to redirect a page/URL that is purely .html to a new location.  I don't know how to do this.  All the redirects I can find are for server side code pages .php/.aspx etc.  From my understanding I can't put a server side redirect in a .html file.  I am hosting on a microsoft server, however the new page I am redirecting to is .php.  I am running some WordPress (.php) files on the server.  I need to make it redirect before the old page loads so visitors don't start reading something that is about to get redirected Can someone please help me?

                        Intermediate & Advanced SEO | | MyNet
                        0

                      Get started with Moz Pro!

                      Unlock the power of advanced SEO tools and data-driven insights.

                      Start my free trial
                      Products
                      • Moz Pro
                      • Moz Local
                      • Moz API
                      • Moz Data
                      • STAT
                      • Product Updates
                      Moz Solutions
                      • SMB Solutions
                      • Agency Solutions
                      • Enterprise Solutions
                      Free SEO Tools
                      • Domain Authority Checker
                      • Link Explorer
                      • Keyword Explorer
                      • Competitive Research
                      • Brand Authority Checker
                      • MozBar Extension
                      • MozCast
                      Resources
                      • Blog
                      • SEO Learning Center
                      • Help Hub
                      • Beginner's Guide to SEO
                      • How-to Guides
                      • Moz Academy
                      • API Docs
                      About Moz
                      • About
                      • Team
                      • Careers
                      • Contact
                      Why Moz
                      • Case Studies
                      • Testimonials
                      Get Involved
                      • Become an Affiliate
                      • MozCon
                      • Webinars
                      • Practical Marketer Series
                      • MozPod
                      Connect with us

                      Contact the Help team

                      Join our newsletter
                      Moz logo
                      © 2021 - 2025 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
                      • Accessibility
                      • Terms of Use
                      • Privacy

                      Looks like your connection to Moz was lost, please wait while we try to reconnect.