AngularJS: How to remove #!/ (bang prefix) from URL?

后端 未结 6 1368
不思量自难忘°
不思量自难忘° 2020-12-03 15:29

I already have done $locationProvider.html5Mode(true); but it is not working. Whenever I access http://example.com it goes to http://example.

6条回答
  •  执笔经年
    2020-12-03 16:07

    Add to your html file

    and this one is for your app.js $locationProvider.html5Mode(true);

    this is for .htaccess create file if you don't have.

    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]
    RewriteRule ^ /foldername/
    

提交回复
热议问题