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 with DNS?
Quick question. Is it possible to 301 redirect a non-www to www. (properly in terms of SEO) with DNS (C Name, A name, or other) ..have searched around and found conflicting information. Would like to know a definite answer. I usually implement all 301 redirects with htaccess. However have a client situation where we only have access to the CMS, but which does have DNS settings. thanks in advance, Greg
Intermediate & Advanced SEO | | GregDixson0 -
Something happened within the last 2 weeks on our WordPress-hosted site that created "duplicates" by counting www.company.com/example and company.com/example (without the 'www.') as separate pages. Any idea what could have happened, and how to fix it?
Our website is running through WordPress. We've been running Moz for over a month now. Only recently, within the past 2 weeks, have we been alerted to over 100 duplicate pages. It appears something happened that created a duplicate of every single page on our site; "www.company.com/example" and "company.com/example." Again, according to our MOZ, this is a recent issue. I'm almost certain that prior to a couple of weeks ago, there existed both forms of the URL that directed to the same page without be counting as a duplicate. Thanks for you help!
Intermediate & Advanced SEO | | wzimmer0 -
How to redirect an url in .htaccess when "redirect 301" doesnt work
I have an odd page url, generated by a link from an external website, it has: %5Cu0026size=27.4KB%5Cu0026p=dell%20printers%20uk%5Cu0026oid=333302b6be58eaa914fbc7de45b23926%5Cu0026ni=21%5Cu0026no=24%5Cu0026tab=organic%5Cu0026sigi=11p3eqh65%5Cu0026tt=Dell%205210n%20A4%20Mono%20Laser%20Printer%20from%20Printer%20Experts%5Cu0026u=fb ,after a .jpg image url, and I can't get it redirect using the redirect 301 in .htaccess to the properly image url as I use to do with the rest of not found urls eg: /15985.jpg%5Cu0026size=27.4KB%5Cu0026p=dell%20printers%20uk%5Cu0026oid=333302b6be58eaa914fbc7de45b23926%5Cu0026ni=21%5Cu0026no=24%5Cu0026tab=organic%5Cu0026sigi=11p3eqh65%5Cu0026tt=Dell%205210n%20A4%20Mono%20Laser%20Printer%20from%20Printer%20Experts%5Cu0026u=fb to just: /15985.jpg
Intermediate & Advanced SEO | | Status0 -
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 | | CoGri0 -
301 Redirect pages with .aspx extension
I want 301 redirect all a website's subpages with a .aspx extension to a page without the .aspx etension. Example: I want to 301 redirect www.website.com/services.aspx to www.website.com/services Right now if you do not include .aspx on the end of every URL it gives a 404 error. I have used the web.config file to 301 redirect non-www to www and /default.aspx to /. I am not extremely familiar with IIS 7.0 or web.config, so any help would be great. Thanks.
Intermediate & Advanced SEO | | VentaMarketing0 -
How to do a 301 redirect for url's with this structure?
In an effort to clean up my url's I'm trying to shorten them by using a 301 redirect in my .htaccess file. How would I set up a rule to grab all urls with a specific structure to a new shorter url examples: http://www.yakangler.com/articles/reviews/other-reviews/item/article-title http://www.yakangler.com/reviews/article-title So in the example above dynamically redirect all url's with /articles/reviews/other-reviews/item/ in it to /reviews/ so http://www.yakangler.com/articles/reviews/boat-reviews/item/1550-review-nucanoe-frontier http://www.yakangler.com/articles/reviews/other-reviews/item/1551-review-spyderco-salt http://www.yakangler.com/articles/reviews/fishing-gear-reviews/item/1524-slayer-inc-sinister-swim-tail would be... http://www.yakangler.com/reviews/1550-review-nucanoe-frontier http://www.yakangler.com/reviews/1551-review-spyderco-salt http://www.yakangler.com/reviews/1524-slayer-inc-sinister-swim-tail with one 301 redirect rule in my .htaccess file.
Intermediate & Advanced SEO | | mr_w0 -
New to SEO. How do I set up a 301 Redirect? What Else should I do?
Hello, I am new to web design. I designed my own site using dreamweaver and did all my seo on my own, I read a few books. Long story short I rank on the bottom of page 1 just after 3 months and the keywords are highly competitive. Now, I am up against some heavy hitters from national brands versus my local real estate site. I don't have a 301 redirect, and am not sure what else I should be doing to get my site ranked higher. I have back links from various sites, ( non-paid ) so it's what others call white hat. When I grade my site on website grader I get a great score versus the sites that are higher than me. I'm guessing my sites age is an issue. I guess I'm looking for some guidance. Thank you all, Here is my site to view. http://www.bronxpad.com
Intermediate & Advanced SEO | | bronxpad0 -
Problem w/ 301 Redirect
Here is how I did the configuration of the redirects: I don’t understand why the destination page is different from the one is configured in the apache server. Any ideas? For example: http://www.meliacaribetropical.com/spanish/entertainment/ is being already being 301 redirected to a 404 page (http://www.meliacaribetropical.com/es/index.htmlentertainment/) that does not exist on the Apache server. As you can see, the url was incorrectly written. Another occurrence from the spreadsheet is http://www.meliacaribetropical.com/spanish/gallery/beach.html, which is also being 301 redirected to a 404 page (http://www.meliacaribetropical.com/es/index.htmlgallery/beach.html). This is causing a hard 404 page. Here is my .httpaccess file: <virtualhost 192.168.200.25:80=""></virtualhost> ServerAdmin ecommerce@sol-group.com DocumentRoot /home/www/solgroup/americas/meliacaribetropical.com ServerName www.meliacaribetropical.com ServerAlias meliacaribetropical.com Redirect permanent /spanish/services/ http://www.meliacaribetropical.com/en/services.html Redirect permanent /entertainment/ http://www.meliacaribetropical.com/en/services.html Redirect permanent /press/ http://www.meliacaribetropical.com/en/index.html Redirect permanent /spanish/ http://www.meliacaribetropical.com/es/index.html Redirect permanent /es/restaurantes/ http://www.meliacaribetropical.com/es/gastronomia.html Redirect permanent /spanish/entertainment/ http://www.meliacaribetropical.com/es/servicios.html Redirect permanent /spanish/services/ http://www.meliacaribetropical.com/es/servicios.html Redirect permanent /es/spa/ http://www.meliacaribetropical.com/es/servicios.html Redirect permanent /spanish/accommodations/ http://www.meliacaribetropical.com/es/habitaciones.html Redirect permanent /spanish/spa/ http://www.meliacaribetropical.com/es/servicios.html Redirect permanent /spanish/royal/ http://www.meliacaribetropical.com/es/servicio-real.html Redirect permanent /spanish/dining/ http://www.meliacaribetropical.com/es/gastronomia.html Redirect permanent /spanish/flintstones/ http://www.meliacaribetropical.com/es/index.html Redirect permanent /es/galeria/ http://www.meliacaribetropical.com/es/visor.html Redirect permanent /spanish/gallery/ http://www.meliacaribetropical.com/es/visor.html Redirect permanent /es/reuniones-eventos/ http://www.meliacaribetropical.com/es/grupos.html Redirect permanent /lowest-rate.php http://www.meliacaribetropical.com/en/index.html Redirect permanent /es/los-picapiedra/ http://www.meliacaribetropical.com/es/index.html Redirect permanent /gallery/beach.html http://www.meliacaribetropical.com/en/index.html Redirect permanent /gallery/dining.html http://www.meliacaribetropical.com/en/gastronomy.html Redirect permanent /gallery/pools.html http://www.meliacaribetropical.com/en/index.html Redirect permanent /spanish/sitemap.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /es/galeria/playa.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /es/galeria/restaurantes.html http://www.meliacaribetropical.com/es/gastronomia.html Redirect permanent /es/galeria/piscinas.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /es/prensa/ http://www.meliacaribetropical.com/es/index.html Redirect permanent /spanish/gallery/beach.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /spanish/gallery/pools.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /spanish/gallery/dining.html http://www.meliacaribetropical.com/es/gastronomia.html Redirect permanent /spanish/press/ http://www.meliacaribetropical.com/es/index.html Redirect permanent /en/groups.html http://www.meliacaribetropical.com/en/groups.html Redirect permanent /terms-condition.php http://www.meliacaribetropical.com/en/index.html Redirect permanent /es/all_inclusive.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /es/terms-condition.php http://www.meliacaribetropical.com/es/index.html Redirect permanent /es/prensa/family-facilities-amenities.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /es/outside-us-telephone-listing.php http://www.meliacaribetropical.com/en/index.html Redirect permanent /spanish/press/melia-international-brand-overhaul.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /es/prensa/melia-international-brand-overhaul.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /press/family-facilities-amenities.html http://www.meliacaribetropical.com/en/index.html Redirect permanent /press/melia-international-brand-overhaul.html http://www.meliacaribetropical.com/en/index.html Redirect permanent /es/prensa/melia-caribe-tropical-announces-fall-promotion.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /spanish/press/melia-caribe-tropical-announces-fall-promotion.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /press/melia-caribe-tropical-announces-fall-promotion.html http://www.meliacaribetropical.com/en/index.html
Intermediate & Advanced SEO | | Melia0