角路由,给人耳目一新404的.htaccess不工作 [英] Angular routing, refreshing gives 404, .htaccess not working

查看:111
本文介绍了角路由,给人耳目一新404的.htaccess不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这已经被问了多次,但我仍然似乎并没有搞清楚什么在我的角度应用程序的问题。

This has been asked multiple times, but still i don't seem to figure out whats the problem in my angular app.

我的路由工作正常,直到我刷新页面,它给了我找不到网页。流行的解决方案是,我添加了一个.htaccess文件到我的应用程序的根目录,但它仍然没有工作。我甚至试过differrent的.htaccess脚本。

My routing works fine, until I refresh the page and it gives me "page not found". Popular solution is that I add a .htaccess file to the root of my app, but it's still not working. I've even tried differrent .htaccess scripts.

推荐答案

试试这个的.htaccess:

Try this .htaccess:

Options +FollowSymLinks

<ifModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !index
    RewriteRule (.*) index.html [L]
</ifModule>

这篇关于角路由,给人耳目一新404的.htaccess不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆