0

I have a Sharepoint 2013 App (Sharepoint hosted). It is a Single Page Application made with AngularJs (ngRouting) and is RESTful.

So url looks like following:
appname/viewOrders
appname/ordersAmount

When I use the navigation e.g. the viewOrdersAll.html loads into ng-view. That's okey and works. But when I hit F5 and the page reloads, I get an 404 Error.
Because the Browser looks for a folder/file appname/viewOrders, but of course there isn't such a folder/file.

Now the question: Are there any possibilities to redirect to the starting page (default.html) with web.config/app.config or similar? On a apache server I can do that with the .htaccess file.
Notice: It's an App.

Or does someone have a better solution for this?

0

Yes, you set the start page url for SharePoint Hosted App in Appmanifest.xml file.

Modify its "StartPage" property to page that you want to be set as startpage

<Properties>
<Title>AppSolution</Title>
<StartPage>~remoteAppUrl/Pages/Default.aspx?{StandardTokens}</StartPage>

Check that page is in Pages folder like this: Pages folder

Double click on AppManifest.xml file and mention your start page. Rebuild it then try it. AppManifest.xml

  • Thanks for your answer. I have edited the AppManifest.xml like you said. But I get following Error: "Sorry, something went wrong" Invalid URL: ~remoteAppUrl/Pages/Default.html? Does the Page have to be an .aspx site? – Roman Oct 8 '14 at 9:27
  • No, it can be html too. But your pages Default.html should be present in Pages folder of solution – ateet Oct 8 '14 at 9:35
  • The Default.html is present in the Pages Folder – Roman Oct 8 '14 at 9:37
  • In that case try to set default page for app as it happen when app is created. And try to visit the default.html from url after app is launched. If you can visit there, then it can be set as start page of apps. try to rebuild the solution then again test it – ateet Oct 8 '14 at 9:39
  • And what is "viewOrders appname" this? A folder then make this folder a single name. and see the heirachy where your page is present. It is in direct Pages/default.html or something else? – ateet Oct 8 '14 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.