Redirecting Hashbang URLs and Maintaining PageRank

Redirecting Hashbang (#!) URLs And Maintaining Pagerank – Tips When Migrating Away from WIX

We recently moved our website away from Wix to WordPress.  We wanted to keep the Google pagerank of the pages we had.  Normally, a 301 redirect would be the best solution.  All human visitors would then be automatically redirected and all search engine indexing bots are told that the page has been permanently relocated (which maintains pagerank).  WordPress has a lot of plugins for 301 redirects, and if you’re handy, you could even do them directly in WordPress or Apache.  The issue was that 301 redirecting hashbang URLs is not possible! URLs containing hashbangs (#!) in them are special  and neither Apache nor WordPress will redirect a hashbang URL.  It seemed to us that no one had resolved the issue doing a redirect and maintaining Google pagerank.  Here’s some of the research we did:

None of what we read was encouraging.

(Digression: Some people had already solved the related problem of how to automatically redirect humans that visit your hashbang URL, say if they had previously bookmarked the page, see www.joeleadedesign.com.au/redirecting-wix-urls . Note that this method doesn’t solve the maintainance of pagerank issue)

Here’s how we solved the hashbang redirection to maintain pagerank problem…we have redirected our hashbang URLs and Google has recognised this.

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 a test, don’t blindly follow me…

The Steps
1) Create a list of all the source URLs you have, and all the destination URLs you want

Source URL =
e.g. www.driversgarage.com.au/#!sports-and-classic-car-hire/c1wc6

Destination URL =
e.g. www.driversgarage.com.au/sports-and-classic-car-hire

2) Create all the destination URL pages

This is the main guts of a migration task.  We were migrating from Wix to WordPress but do what’s appropriate for you.
BTW if you are doing a migration, now is a great time to review your SEO.  I used Yoast SEO on WordPress.

3) Work out what the Ugly versions of all hashbang (pretty) URLs should be and record them

Google presently doesn’t index the pretty version of your website pages they index the ‘ugly’ version.  Chances are if you’ve got hashbang URLs then the platform you are using (e.g. Wix) automatically generates pages for these ugly URLs for Google to index.  Check this.  If you’ve no idea what I’m on about you can read up at: https://developers.google.com/webmasters/ajax-crawling/docs/specification

In a nutshell, you need to:

  • substitute “?_escaped_fragment_=” into the URL  where it says “#!”

e.g. Pretty URL
www.driversgarage.com.au/#!sports-and-classic-car-hire/c1wc6

e.g. Equivalent Ugly URL
www.driversgarage.com.au/?_escaped_fragment_=sports-and-classic-car-hire/c1wc6

4) Implement 301 Redirects for the Ugly URLs

Redirect all the ugly URLs using your chosen method (e.g. WordPress plugin, Apache, etc). Ugly URLs redirect fine.  It’s the pretty URLs with the hashbang which can’t be redirected.

5) Deploy a Sitemap with Pretty URLs

Deploy a sitemap with the pretty URLs of the pages to be redirected, as well as the new pages.  If you’re using Wix, you can get the automatically generated sitemap at /sitemap.xml.

6) Submit Your Sitemap to Google Webmaster Tools
  • Log in to admin.google.com
  • Search for “Google Webmaster Tools”
  • Submit your sitemap
7) Wait for Google to re-index all your pages

This step might take a month or more…

See an example of one of our pages:

A) Google seems to be hitting our old hashbang (#!) (pretty URL) page

01 Google Hit on old page

B) …but check the cached version

02 View cached version

C) Cached version shows the new page

03 cached version shows new site

D) The cached text only version shows the new, redirected URL.

Hit “Text only version” and observe that the cached version shows the new URL (i.e. neither the pretty hashbang or the ugly URL).  Job done.

04 text only version - relevant bits zoomed

04 text only version

8) Check that the new URL(s) show up in Google search results too
9) Clean up – Remove the pretty URLs from the sitemap

Remove the “pretty” hashbang URLs from the sitemap. Just leave the new URLs in there.  Resubmit to sitemap in Google Webmaster Tools.

Job done!


Share some love

If you found this post useful, show us some love and like/follow us!


By using this Website, you agree to and are bound by our Website Terms and Conditions of Use.

Leave a Reply