Link breaking by typing directly into the browser

Asked

Viewed 31 times

0

I am developing an angular project that is breaking the link when it has parameter and is typed directly in the browser, only occurs when it is published in IIS, if I do the same in the published in development in "ng serves" this same error does not occur, looking at Chrome’s console the error it presents to me is "Uncaught Syntaxerror: Unexpected token <", I noticed that in Sources all uploaded files are loading index.html which is generating this error, if the parameter link is generated internally by the angle by clicking on a Button or Link it works correctly, but even this link pressing enter in the browser bar occurs this same problem. On IIS I am using the Rwriter URL to be able to use the routes through the web browser.config

<configuration>
 <system.webServer>
  <rewrite>
   <rules>
    <rule name="Angular Routes" stopProcessing="true">
     <match url=".*" />
     <conditions logicalGrouping="MatchAll">
      <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
      <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
     </conditions>
     <action type="Rewrite" url="./" />      
    </rule>
   </rules>
 </rewrite>
 </system.webServer>
</configuration>

"http://www.checkbooking.com.br/checkinexpress/register/a" does not process the file . ts, I have tried to put anguns logs, and also does not pass the Interceptor I created

  • this /checkingexpress is a route of use application? Or type the index is there?

  • @Eduardovargas yes, the index is on this route, if you access this path it redirects to login

  • tries to build it like this: ng build --base-href=/checkinexpress/

  • @Eduardovargas thank you worked, put your reply that I mark it as the solution

  • link to help others here

1 answer

1


Because your url is one level up instead of your site.com is your site.com/something

you have to build so:

ng build --base-href=/something/

or in your case

ng build --base-href=/checkinexpress/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.