首先,我要说的是我在 .htaccess
和 redirects
中的新秀。
问题是,我有一个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>