无哈希的角度:Apache上的错误404
我从Angular应用程序的URL中删除了##,但我遇到了一个大问题...我遵循了许多“解决方案”,但结果是相同的。.
我的应用程序“ my-app”部署在Apache2(in subfolder)上=> /var/www/html/my-app
首先访问该应用程序(http:// xxxxxx/my-app)=>重定向到登录页=>好的 刷新页=>错误404 !!!
我在public_html(即/var/www/html)和子级别(即/var/www/html/my-app)中添加了.htaccess文件,但仍然有错误...
htaccess/var/var/www/www/www/html :
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*) /index.html [NC,L]
</IfModule>
在这里.htaccess/var/www/html/my-app:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*) /my-app/index.html [NC,L]
</IfModule>
请有任何想法解决此问题吗? 谢谢 !!
I removed # from my Angular application's url but I face a BIG problem... I followed many "solutions" but the result is the same..
My application "my-app" deployed on Apache2 (in subfolder) => /var/www/html/my-app
First access to the app (http://xxxxxx/my-app) => redirect to login page => OK
Refresh page => ERROR 404 !!!
I added .htaccess files in public_html (ie /var/www/html) and sub-directory (ie /var/www/html/my-app) but still have the error...
Here .htaccess /var/www/html :
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*) /index.html [NC,L]
</IfModule>
And here .htaccess /var/www/html/my-app :
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*) /my-app/index.html [NC,L]
</IfModule>
Have any idea please to solve this problem ?
Thank you !!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的构建文件目录中添加下面,然后从Apache durecly点添加到此文件夹
Add below to your build file directory and from apache direcly point to this folder