我怎样才能在我的AngularJS网站网址摆脱散列标签吗? [英] How can I get rid of the hash tag in my AngularJS site URL?
问题描述
我上传了AngularJS网站我的 GH-页
分支所指向的DNS A记录到204.232.175.78。现在,该网站是活的,但我看到了一个散列标签作为URL结构的一部分。这里有两个网址可以在
I uploaded an AngularJS site to my gh-pages
branch and pointed the DNS A records to 204.232.175.78. Now the site is live but I see a hash tag as part of the URL structure. Here are the two URLs one can see the home page of the site at
http://siddhion.github.io/maxmythic_angular/#/
我想游人进入,看到在地址栏中的网址是简单的 maxmythic.com 。如果一个人进入 maxmythic.com 重定向到的 http://www.maxmythic.com/#/ 。
The URL I want visitors to enter and see in the address bar is simple maxmythic.com. If one enters maxmythic.com it redirects to http://www.maxmythic.com/#/.
我怎么会做主页的网址只是 maxmythic.com ,提供了 WWW。和结尾的 /#/
How would I make the URL of the home page just maxmythic.com with out the www. and trailing /#/
推荐答案
在应用程序的主模块的配置功能,使用的 html5mode()
功能 $ locationProvider
。阅读这些文档的更多信息:<一href=\"http://docs.angularjs.org/api/ng.%24locationProvider\">http://docs.angularjs.org/api/ng.$locationProvider和<一个href=\"http://docs.angularjs.org/guide/dev_guide.services.%24location\">http://docs.angularjs.org/guide/dev_guide.services.$location.
In the app's main module's config function, use the html5mode()
function of the $locationProvider
. Read these docs for more info: http://docs.angularjs.org/api/ng.$locationProvider and http://docs.angularjs.org/guide/dev_guide.services.$location.
例如:
angular.module('myApp', []).
config(function($locationProvider) {
$locationProvider.html5Mode(true);
});
这篇关于我怎样才能在我的AngularJS网站网址摆脱散列标签吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!