Vue-router on apache, SPA in sub-directory, can only access pages by redirect

前端 未结 3 547
陌清茗
陌清茗 2021-02-04 17:58

So I have a Vue app for a client set up on an apache dev server. I am doing this to match the production environment. The app is in a subdirectory and I set the \'base\' option

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-04 18:51

    It can be a bug with your apache version.

    RewriteRule of "^$" broke between 2.2.21 and 2.4.2 https://bz.apache.org/bugzilla/show_bug.cgi?id=53929

    You can use Fallback ressource instead of mod_rewrite in your apache config. It works for me.

    In /etc/apache2/apache2.conf

    
        ServerName YourServerName
        DocumentRoot /var/www/yourApp/dist
        
            FallbackResource /index.html
        
    
    

提交回复
热议问题