I want to remove # from my angularjs app, I am developing an website, I think it may help to make SEO friendly website, May be i am wrong, Please help
Thanks
I want to remove # from my angularjs app, I am developing an website, I think it may help to make SEO friendly website, May be i am wrong, Please help
Thanks
2
Answers
Config
To remove the # in your url you need to add this to your main module. You put the app into html5 mode.
Server Side (NodeJS)
This will have a server side effect when you hit refresh you need to add an extra route that is able to find the new url. this will work in your express js
app.js
file. Where the public folder contains your angular app and you have yourindex.html
file in thereI agree with Joe Lloyd for the way to remove the # from your url but it won’t help you to make your angularjs website crawlable.
Check out the following steps :
Configure the html5mode
config(function ($routeProvider, $locationProvider) {
$locationProvider.html5Mode(true);
Add
<meta name="fragment" content="!">
to your pages so the google bot knows to add the ?_escaped_fragment_= at the end of your request.Handle the
?_escaped_fragment_=
on the server side and serve a static snapshot of the requested html page (phantomjs can make the job) so the bot will index the rendered version of the html page.Populate your sitemap.xml and send it to google using http://www.google.com/webmasters/
Have fun !