Angular 2 .htaccess



首先,我要说的是我在 .htaccessredirects中的新秀。

问题是,我有一个Angular 2应用程序完美工作,但是在此之前,我使用了一些.php文件将图像上传到服务器。但是,在上传.htaccess以解决路线问题之后。这些.php不再起作用。

这是我当前的.htaccess文件。

<IfModule mod_rewrite.c>
 Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Credentials true
  Options Indexes FollowSymLinks
  RewriteEngine On
  RewriteBase /home/
  RewriteRule ^index.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/(upload|upload_cover).php
  RewriteRule . /index.html [L]
</IfModule>

我找不到解决方案:(。

  /
    -.htaccess
    -images/
    --content/
    -upload.php
    -main.bundle.js
    -inline.bundle.js
    -index.html
    -main/

您可以尝试此简化的.htaccess吗?它将所有内容重定向,除非有匹配的目录或文件。

<IfModule mod_rewrite.c>
    Header set Access-Control-Allow-Origin "*"
    Header set Access-Control-Allow-Credentials true
    Options Indexes FollowSymLinks
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . index.html [L]
</IfModule>

最新更新