I currently have a WIX website. I’m now moving to Wordpress. Before I go live with my new site, I need to redirect all the urls which includes hashbangs (#!) from the old site to the new pretty urls.
I’ve tried to do a 301 redirect in htaccess (Redirect 301 /#!about/c2tp /about) but that doesn’t work. I’ve done a lot of research, but nothing seems to be working for me. I’ve heard a few people use sitemap to 301 redirect hashbang url, but I cannot understand how they could do this.
Google has indexed my webpages including the #!. Any suggestions would be appreciated.
I think the part of the url after the hash is not send to the server, so the htaccess redirect won’t work. You could some JavaScript redirect, but it won’t be a permanent solution.
Google use to request urls with hashbang (#!) using the _escaped_fragment_ query parameter. The official post about making ajax request crawable is from 2009. You could check if that is done in your server and do the redirect that way.
Although they are disallowed within the URI syntax, we include here a
description of those US-ASCII characters that have been excluded and
the reasons for their exclusion.
…
delims = “<” | “>” | “#” | “%” | <">
Other characters are excluded because gateways and other transport
agents are known to sometimes modify such characters, or they are
used as delimiters.
…
4.1. Fragment Identifier
When a URI reference is used to perform a retrieval action on the
identified resource, the optional fragment identifier, separated from
the URI by a crosshatch (“#”) character, consists of additional
reference information to be interpreted by the user agent after the
retrieval action has been successfully completed. As such, it is not
part of a URI, but is often used in conjunction with a URI.
As such, the # is irrelevant to the server and only provides information to the browser (for an anchor within a page).
Learning the correct syntax for URIs is critical for webmasters so take a few minutes to go through that rather lengthy document.