小编Ale*_*lex的帖子

如何将我的 .htaccess 转换为 AWS Amplify 的重写

我在 AWS Amplify 上提供 Angular SPA,我想重新创建与我在.htaccess文件中相同的重写规则:

RewriteEngine On

# Remove trailing /
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Rewrite spiders to static html
RewriteCond %{HTTP_USER_AGENT} (googlebot|bingbot|msnbot|yahoo|Baidu|aolbuild|facebookexternalhit|iaskspider|DuckDuckBot|Applebot|Almaden|iarchive|archive.org_bot) [NC]
RewriteCond %{DOCUMENT_ROOT}/static%{REQUEST_URI}.html -f
RewriteRule ^(.*)$ /static/$1.html [L]

# Rewrite spiders to static index.html
RewriteCond %{HTTP_USER_AGENT} (googlebot|bingbot|msnbot|yahoo|Baidu|aolbuild|facebookexternalhit|iaskspider|DuckDuckBot|Applebot|Almaden|iarchive|archive.org_bot) [NC]
RewriteCond %{REQUEST_URI} "^/$"
RewriteRule ^ /static/index.html [L]

# If an existing asset or directory is requested, serve it
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]

# If the requested resource doesn't …
Run Code Online (Sandbox Code Playgroud)

.htaccess angular aws-amplify

7
推荐指数
0
解决办法
173
查看次数

标签 统计

.htaccess ×1

angular ×1

aws-amplify ×1