Deploying multiple versions of Angular app to Azure App Service

前端 未结 3 805
萌比男神i
萌比男神i 2021-02-08 13:31

I have an Angular application which I can deploy to Azure App Service without any issues.

First I compile my application using the following command:

ng          


        
3条回答
  •  没有蜡笔的小新
    2021-02-08 14:15

    For anyone looking for a generic solution see below.

    It does 2 things:

    • Handle default language via redirect (our default language is de)
    • Handle rewires for any language
      • it uses regex to capture the language part (2 character language string + slash) from the beginning of the path, for example de/ or en/
      • it then uses the capture group to rewrite the path

    Note:

    • This will not limit which language codes a user can request via url
    • If you want to be specific which languages are supported you can replace the regex with the following to only support de + en + fr:
      ^((?:de|en|fr)\/).*
    
    
      
        
          
          
        
          
            
              
              
                
                
              
              
            
          
        
      
    
    

提交回复
热议问题