How to rewrite url in apache htaccess for angularjs app

前端 未结 2 1937
遇见更好的自我
遇见更好的自我 2021-01-22 13:05

The htaccess I\'m using is as follow

RewriteBase /
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %         


        
相关标签:
2条回答
  • 2021-01-22 13:50

    I handle this issue in my project with working on my VirtualHost

    <VirtualHost *:8888>
        DocumentRoot "/Applications/MAMP/htdocs/angular"
        ServerName  zeyton.dev
        ServerAlias www.zeyton.dev
        DirectoryIndex index.html
      <Directory "/Applications/MAMP/htdocs/angular">
        order allow,deny
        allow from all
        RewriteEngine on
        RewriteCond %{REQUEST_FILENAME} -s [OR]
        RewriteCond %{REQUEST_FILENAME} -l [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule ^.*$ - [NC,L]
        RewriteRule ^(.*) /index.html [NC,L]
      </Directory>
    </VirtualHost>
    
    0 讨论(0)
  • 2021-01-22 13:53
    RewriteEngine   On
    RewriteBase     /
    RewriteCond     %{REQUEST_URI} !^(/index\.php|/img|/js|/css|/robots\.txt|/favicon\.ico)
    RewriteCond     %{REQUEST_FILENAME} !-f
    RewriteCond     %{REQUEST_FILENAME} !-d
    RewriteRule     ./index.html [L]
    
    0 讨论(0)
提交回复
热议问题