Skip to content

apache .htaccess not working with lazy-loaded routes #2753

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xseignard opened this issue Apr 29, 2019 · 2 comments
Closed

apache .htaccess not working with lazy-loaded routes #2753

xseignard opened this issue Apr 29, 2019 · 2 comments

Comments

@xseignard
Copy link
Contributor

Version

3.0.3

Reproduction link

https://beta.pow.cool/members

Steps to reproduce

  • Create a new app
  • Add a lazy loaded route named 'myRoute'
  • Build it
  • Check that you have a myRoute.js file in your build folder
  • Deploy it to an apache server after following the .htaccess recommandation in the vue-router docs
  • Check that your browser shows the content of the myRoute.js file instead of serving the index.html file when browsing http://mysite.com/myRoute

What is expected?

The browser shoud display the index.html at the given route.

What is actually happening?

The browser displays the js content of the javascript file.


It works as expected with the following conf (taken from create-react-app):

Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]
@posva
Copy link
Member

posva commented Apr 29, 2019

I see, can you submit a Pull request with the configuration provided. I don't use Apache, so I will need someone to validate it though

@posva posva added the docs label Apr 29, 2019
@posva
Copy link
Member

posva commented Apr 29, 2019

we have the apache tomcat one

xseignard added a commit to xseignard/vue-router that referenced this issue May 2, 2019
On apache we need to add more configuration to handle lazy loaded
routes. Updated docs in all available languages.
@posva posva added the has PR label Aug 8, 2020
@posva posva closed this as completed in 3a95aaa May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants