无哈希的角度:Apache上的错误404

发布于 2025-02-13 08:42:02 字数 963 浏览 0 评论 0原文

我从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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

恍梦境° 2025-02-20 08:42:02

在您的构建文件目录中添加下面,然后从Apache durecly点添加到此文件夹

   <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /
      RewriteRule ^index\.html$ - [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.html [L]
    </IfModule>

“

Add below to your build file directory and from apache direcly point to this folder

   <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /
      RewriteRule ^index\.html$ - [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.html [L]
    </IfModule>

apache site

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文