.htaccess for subfolder of AngularJS app with HTML5 mode

后端 未结 2 1675
甜味超标
甜味超标 2021-02-20 10:14

Overview :

I have an AngularJS application that uses $locationProvider.html5Mode(true) and it is served from an Apache ser

2条回答
  •  情书的邮戳
    2021-02-20 10:55

    Inside public_html => /app => .htaccess try this :

    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
    RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ dist/index.html [L]
    

    Note : HTML tag should be point to the dist folder. I hope this solution will work as per your expectations.

提交回复
热议问题