我正在尝试弄清楚我的.htaccess文件应该是什么样子。我正在与我的VueJS不同的https域上运行SPA api应用程序。
我似乎有我下面的规则,但它不排除/static文件夹,所以没有我的资产(字体,css等)是正确加载。
我似乎在Google上找不到一个合适的例子来匹配我的设置(在不同的域上使用api和app的https SPA )。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ https://my-vue-domain.com/$1 [R]
RewriteRule ^(static) - [L]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/static/
RewriteRule (.*) index.html [QA,L]
</IfModule>发布于 2017-10-06 04:16:52
例如,如果/static/js/app.js是文档根目录中的实际文件,则根本不需要排除它,因为您确实使用以下命令排除了所有文件和文件夹:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d我会删除:
RewriteRule ^(static) - [L]和
RewriteCond %{REQUEST_URI} !^/static/https://stackoverflow.com/questions/46593732
复制相似问题