Redirect to hash URL

Posted by r1987 on Stack Overflow See other posts from Stack Overflow or by r1987
Published on 2012-10-13T09:32:38Z Indexed on 2012/10/13 9:36 UTC
Read the original article Hit count: 129

Filed under:
|
|
|

I'm building a site with a hashchange on wordpress, all working good. It just loads a single.php template file into a div.

The problem is that i can still access my single url (http://www.mydomain.com/my-single-post). Since its not having any head and style tags with it, i don't want people to go over there. Also google has picked up the direct links, because I use the href attribute to load content into the div.

So my question is:

If someone clicks a link lets say in a forum, http://www.mydomain.com/my-single-post , is it possible to redirect him instantly to http://www.mydomain.com/#my-single-post ? I have researched that it has something to do with .htaccess, but I also have Pages, where i don't want the hash infront of the page-name.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX