LOTUSMS
LOTUSMS

Reputation: 10240

%2F is replacing the forward slash when $locationProvider.html5Mode is true

I am trying to beautify an angular site. The trailing hashtag is a pain and it is conflicting with how Spiders crawl the site. So basically domain.com/about is shown domain.com/#/about, but when spiders hit the non-hashtag version they get a 404. Long story short, I want the hashtag gone lol

I followed this SO Question and it got me pretty far by using the code below.

$locationProvider.html5Mode({
      enabled: true,
      requireBase: false
});

I was able to get rid of the hashtag. But only on the home page. Any other page got even weirder.

Now the domain.com/#/about actually looks like domain.com/#%2Fabout.

Can anyone tell me how can simply get rid of the hashtag?

Upvotes: 1

Views: 289

Answers (1)

Khalid Hussain
Khalid Hussain

Reputation: 1694

May be you have an anchor tag like this:

<a ng-href="#/about">About</a>

Replace #/ with /. So modified anchor tag should look like this:

<a ng-href="/about">About</a>

Hope this solve your problem. If it does not solve your problem, please add detail code. Without detail information, it is difficult to answer question.

Upvotes: 1

Related Questions