.htaccess 导致解析源映射失败

.htaccess causes fail in parsing source maps

在网页上,.htaccess 是:

RewriteEngine On
RewriteBase /
Options -MultiViews
DirectorySlash Off

# skip POST requests
RewriteCond %{REQUEST_METHOD} POST
RewriteRule ^ - [L] 

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ / [L,R=301]

RewriteCond %{DOCUMENT_ROOT}/.php -f
RewriteRule ^(.+?)/?$ /.php [L]

# redirect to .php-less link if requested directly
RewriteCond %{THE_REQUEST} ^[A-Z]+\s.+\.php\sHTTP/.+
RewriteRule ^(.+)\.php  [R=301,L]

Options All -Indexes

ErrorDocument 403 /img/error.php
ErrorDocument 404 /img/error.php
ErrorDocument 500 /img/500.png

它会导致下一个错误:

Failed to parse SourceMap: .../js/bootstrap-select.js.map

我删除的时候没有出现这个错误。 我应该如何修改.htaccess?

通过将 error.php 更改为图片解决了问题(在 error.php 中有重定向到索引页面)。

即使你自己回答了我只是想 post 这样其他遇到这个问题的人就会确切地知道发生了什么

警告:

Do not use .htaccess to redirect error to another HTML/PHP page or server that isn't your own (such as this error.php). Errors can be replaced by other images, not with an HTML or PHP page as that might cause indefinite loop too.