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 redirect recovery
Hello Please understand that English is poor. I used to run a site called A This time, I am running a site called B. I need to set up a temporary 302 redirect from A to B
Intermediate & Advanced SEO | | jinseok
I accidentally set a 301 redirect Site A has many spam links
For now I have removed the 301 redirect source to B. Will A's spam links affect site B?
For your reference, Site B is putting a lot of effort into SEO. Help me.0 -
My site lost a lot of traffic in the lastest update - what to do?
Hi all, there seems to have been an algorithm update on February 7. One of my big sites www.poussette.com, lost about 25 % of its organic traffic afterwards and has not revovered yet. What are the best steps to take right now? It is 7 years old we continuously did conservative SEO (technical, link building, adding content). Thanks in advance. Dieter
Intermediate & Advanced SEO | | Storesco0 -
Adventurous 301 redirection chain
Picture this - if you have a spirit for adventure! Client builds Alpha****Domain.com Then builds a number of backlinks to Alpha****Domain.com Client also creates a number of 301 redirects from several older domains to AlphaDomain.com Client then changes Alpha****Domain.com to Beta****Domain.com They create 301 redirects from Alpha****Domain.com to Beta****Domain.com But then... they 'park' Alpha****Domain.com (ie. no longer accessible)! About one year later, client changes a whole bunch of URLs on Beta****Domain.com without keeping track of changes. Thankfully, the hosting service (Shopify) automatically creates some redirects, but it's more by accident than design! Questions: After step 6 above, are the 301 redirects created in steps 3 and 5 now totally redundant and broken? If AlphaDomain.com no longer exists, surely all redirects to and from this domain are broken? Or can they be recovered? What happens to all the backlinks originally created in step 2? Finally, can anything be done to recover lost URLs in step 7? Yes. What a mess!
Intermediate & Advanced SEO | | muzzmoz0 -
Does removal of internal redirects(301) help in SEO
I am planning to completely remove 301 redirects manually by replacing such links with actual live pages/links. So there will be no redirects internally in the website. Will this boost our SEO efforts? Auto redirects will be there for incoming links to non-existing pages. Thanks, Satish
Intermediate & Advanced SEO | | vtmoz0 -
New Site Launch - Redirecting Hundreds of Old Invalid URLs?
We have a client whose WMT shows a ton of "Not found" crawl errors after a new site launched. The URLs are largely a bunch of files that they had previously uploaded on their old site which have external links pointing at them. What is their best course of action, if they don't have files on the new site that correspond with these old files? Redirect to the home page? Leave them 404ing? Customize 404 message? (Note: They're mostly generic, non-human friendly URLs that are difficult to identify like /gallery3.php/ppage/3, g/interior.php/pid/3/sid/24, /uploads/1213196781.pdf)
Intermediate & Advanced SEO | | VTDesignWorks0 -
301 old site to new site?
I have client with an old site - www.bestfamilylawattorney.com - which had a lot of spammy links (and bad rankings). Instead of fixing those issues, we started a new URL - www.berenjifamilylaw.com - with new content and redesign. Should I do a 301 redirect from old to new domain? If the old site was being penalized, would a 301 transfer that penalty? I just want to make sure I don't end up hurting the new site after doing all the work to start fresh. Thanks.
Intermediate & Advanced SEO | | mrodriguez14400 -
301 Redirect from unused domain
Hi All First question here so go easy.. I have a property site which is working well so far considering it;s early days, unfortunately some of my earlier efforts did not go so well and one in particular I pretty much destroyed in my attempts to improve the site SEO. Lucky enough my SEO skills have improved quite a bit lately, largely thanks to the great tools, tutorials and experts here at Moz 🙂 My question is whether I can use a 301 redirect to pass the domain authority and any link equity from an unused site to the one that ive done a better job on? it would seem a little sketchy to me and I would prefer not to get slapped and penalized "again" for doing something dodgy... Thanks everyone and thanks for all the help over the last 6 months or so.. Wes Dunn
Intermediate & Advanced SEO | | wesdunn19771 -
301 Redirect To Corresponding Link No Matter The URL?
Hey guys I have hosting on Host Gator with I believe an apache web server. I need a code to put in the HT ACCESS to redirect all WWW URL's to their corresponding http URL. I haven't been able to get a code to work. For example, http://www.mysite.org/page1.html -> http://mysite.org/page1.html , without having to redirect hundreds of pages individually Here is the format my server uses in the HT ACCESS file for 301 redirects. RewriteCond %{HTTP_HOST} ^mysite.org$ [OR] RewriteCond %{HTTP_HOST} ^www.mysite.org
Intermediate & Advanced SEO | | DustinX
$RewriteRule ^Electric-Pressure-Cookers.html$ "http://mysite.org/Pressure-Cookers.html" [R=301,L] Thanks0