Hash url (snippet) can be crawled by search engines?

I am working on angularjs and php.

I have this sample url:

www.example.com/#/MySite

I am trying to find it on google and I cannot find it and why?

Is there a way if I search "mysite www.example.com"

and it shows that the results on the search engines (google.com) will be "www.example.com/mysite"

and as soon as I click on the link it will be redirected to www.example.com/#/mysite

.

+3


source to share


1 answer


You are looking for HTML5 mode of location provider in AngularJS. Google will not index URLs that are routed by the hash. This should work for both standard Angular router and ui-router. Read the entire article on HTML5 mode as it needs a lot of attention (including google crawling).

Enable it by adding $locationProvider.html5Mode(true)

to config()

your app module section .



The main caveat is that copy-to-url doesn't work and you have to set up the server-side so that all paths will render the Angular app. ui-router has good documentation on this

+1


source







All Articles