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
-
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.
-
The solution I came up with was:
- Create a list of all the source URLs you have, and all the destination URLs you want
- Create all the destination URL pages
- 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)
- Implement 301 Redirects for the Ugly URLs
- Deploy a Sitemap with Pretty URLs
- Submit Your Sitemap to Google Webmaster Tools
- Wait for Google to re-index all your pages
- Check that the new URL(s) show up in Google search results too
- 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.
-
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.
-
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.
-
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
-
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
-
With the JavaScript option, people who bookmarked the page will get redirected.
-
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
-
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).
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
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.
Related Questions
-
301 vs Canonical - With A Side of Partial URL Rewrite and Google URL Parameters-OH MY
Hi Everyone, I am in the middle of an SEO contract with a site that is partially HTML pages and the rest are PHP and part of an ecommerce system for digital delivery of college classes. I am working with a web developer that has worked with this site for many years. In the php pages, there are also 6 different parameters that are currently filtered by Google URL parameters in the old Google Search Console. When I came on board, part of the site was https and the remainder was not. Our first project was to move completely to https and it went well. 301 redirects were already in place from a few legacy sites they owned so the developer expanded the 301 redirects to move everything to https. Among those legacy sites is an old site that we don't want visible, but it is extensively linked to the new site and some of our top keywords are branded keywords that originated with that site. Developer says old site can go away, but people searching for it are still prevalent in search. Biggest part of this project is now to rewrite the dynamic urls of the product pages and the entry pages to the class pages. We attempted to use 301 redirects to redirect to the new url and prevent the draining of link juice. In the end, according to the developer, it just isn't going to be possible without losing all the existing link juice. So its lose all the link juice at once (a scary thought) or try canonicals. I am told canonicals would work - and we can switch to that. My questions are the following: 1. Does anyone know of a way that might make the 301's work with the URL rewrite? 2. With canonicals and Google parameters, are we safe to delete the parameters after we have ensures everything has a canonical url (parameter pages included)? 3. If we continue forward with 301's and lose all the existing links, since this only half of the pages in the site (if you don't count the parameter pages) and there are only a few links per page if that, how much of an impact would it have on the site and how can I avoid that impact? 4. Canonicals seem to be recommended heavily these days, would the canonical urls be a better way to go than sticking with 301's. Thank you all in advance for helping! I sincerely appreciate any insight you might have. Sue (aka Trudy)
Intermediate & Advanced SEO | | TStorm1 -
Possible issues with 301 redirecting to a new domain name
Ive got a current domain and after a bit of a rebrand Im considering 301 rediecting the current site to a newly purchased domain. Id redirect each age to idential pages. Am I likely to see any issues. I know this is the recomended way from Google but just wondering how smoothly it works and whether Im likely to see any ranking drops or other problems?
Intermediate & Advanced SEO | | paulfoz16090 -
Duplicate URLs on eCommerce site caused by parameters
Hi there, We have a client with a large eCommerce site with about 1500 duplicate URLs caused by the parameters in the URLs (such as the sort parameter where the list of products are then sorted by price, age etc.) Example: www.example.com/cars/toyota First duplicate URL: www.example.com/cars/toyota?sort=price-ascending Second duplicate URL: www.example.com/cars/toyota?sort=price-descending Third duplicate URL: www.example.com/cars/toyota?sort=age-descending Originally we had advised to add a robots.txt file to block search engines from crawling the URLs with parameters but this hasn't been done. My question: If we add the robots.txt now and exclude all URLs with filters - how long will it take for Google to disregard the duplicate URLs? We could ask the developers to add canonical tags to all the duplicates but these are about 1500... Thanks in advance for any advice!
Intermediate & Advanced SEO | | Gabriele_Layoutweb0 -
Clarification around 301 redirects.
I’ve come across numerous blogs recently that suggest that SEOs should NOT do bulk re-directs to a category page. This has come as something of a surprise (doh!!) and I feel like I should already know this. It does seem like there is lots disagreement here so I thought that I’d ask what people’s opinions were to make sure that I get my thinking straight. I've read all the main Moz blog posts on this topic and, although really useful, they've left me none the wiser around a few specific questions. Here’s some more detail about the situation. We’re currently consolidating a lot of content into a main blog, which will be the focal point of new blogs posts that are created. This is different to the past, where we tended to create separate blogs for different products on separate domains. I’m currently considering how we move content across from one the older blogs to this new blog (which will soon sit on a subfolder of our main domain). I have three (!) questions: 1) Could you confirm that doing bulk re-directs a category page is bad? I already know that doing them all to the homepage is an error. 2) Should I re-direct the home page of the old blog on a separate domain to the relevant category page on the new site? The category page is related, but does not cover the EXACT topic. The category page covers our replacement product offering. It I shouldn't do this, where should I re-direct the old blog domain to? 3) I’ve recommended that we set up 301 redirects on a one-to-one basis, redirecting each piece of content to its new location on the old site. What about content that has been earmarked for removal and for which there is no obvious alternative? My previous recommendation has been to re-direct these pages to the most relevant category page on the new blog. Would it be better to let this 404 or, as an alternative, create a custom 404 for the users on the new blog highlighting the new content that we offer? Any help would be appreciated 🙂
Intermediate & Advanced SEO | | RG_SEO0 -
Duplicate Multi-site Content, Duplicate URLs
We have 2 ecommerce sites that are 95% identical. Both sites carry the same 2000 products, and for the most part, have the identical product descriptions. They both have a lot of branded search, and a considerable amount of domain authority. We are in the process of changing out product descriptions so that they are unique. Certain categories of products rank better on one site than another. When we've deployed unique product descriptions on both sites, we've been able to get some double listings on Page 1 of the SERPs. The categories on the sites have different names, and our URL structure is www.domain.com/category-name/sub-category-name/product-name.cfm. So even though the product names are the same, the URLs are different including the category names. We are in the process of flattening our URL structures, eliminating the category and subcategory names from the product URLs: www.domain.com/product-name.cfm. The upshot is that the product URLs will be the same. Is that going to cause us any ranking issues?
Intermediate & Advanced SEO | | AMHC0 -
For URLs that require login, should our redirect be 301 or 302?
We have a login required section of our website that is being crawled and reporting as potential issues in Webmaster Tools. I'm not sure what the best solution to this is - is it to make URLs requiring a login noindex/nocrawl? Right now, we have them 302 redirecting to the login page, since it's a temporary redirect, it seems like it isn't the right solution. Is a 301 better?
Intermediate & Advanced SEO | | alecfwilson0 -
How do I set up a 301 redirect if the default settings for our web servers create multiple URLs for the same page?
How do I set up a 301 redirect if the default settings for our web servers create multiple URLs for the same page but only views it as one page?
Intermediate & Advanced SEO | | ibex0 -
Has anyone found a way to get site links in the SERPs?
I am wanting to get some site links in the serps to increase the size of my "space", has anyone found a way of getting them? I know google says that its automatic and only generated if they feel it would benifit browsers but there must be a rule of thumb to follow. I was thinking down the line of a tight catagorical system that is implimented throughout the site that is clearly related to the content (how it should be I guess)... Any comments, suggestions welcome
Intermediate & Advanced SEO | | CraigAddyman0