0

I have implemented pretty url in angular(switched to html5mode).

When I am refreshing the page I get 404 error.

For example: If I open my app using http://server/, everything works fine,but when I refersh the page or try open specific page ex http://server/mypage, I get 404 error.

Note:

  • When compiling my application I am combining templates in javascript.
  • And after compilation my scripts(with template) goes in build folder and base tag in index.html is set to "/";.

  • I am using Angular-ui-router.

  • Using .net as backend.
  • Frontend app is total separate from backend & both are deployed in IIS.

Please suggest what could be the possible solution or reason for the error.

Thanks

1 Answer 1

0

You are should to check your settings in backend, when i am using html5 history, i have for this my .htaccess file (where you redirect all your requests to your root index.php or index.html file), look my .htaccess:

RewriteEngine On  
  # If an existing asset or directory is requested go to it as it is
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
  RewriteRule ^ - [L]

  # If the requested resource doesn't exist, use index.html
  RewriteRule ^ /index.html

if this not help, you are can to read this [article]

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.