【发布时间】:2017-07-02 11:35:33
【问题描述】:
这是我的 Angular 路由器配置:
const appRoutes: Routes = [
{ path: 'home', component: HomeComponent,
data: {
animation: {
value: 'home',
}
}
},
{ path: 'about', component: AboutComponent,
data: {
animation: {
value: 'about',
}
}
},
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{ path: '**', component: ErrorComponent }
];
每次我尝试导航到 www.myapp.com/sitemap.xml 时,它都会匹配 ErrorComponent 并重定向到我的 404 页面。
如何配置 apache 服务器以阻止 sitemap.xml 转到 index.html?
以下是我在 .htaccess 文件中的重写规则:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
【问题讨论】:
-
配置你的服务器not当路径是sitemap.xml时提供index.html
-
如何在 .htaccess 文件中定位 sitemap.xml?
-
我已将 .htaccess 代码添加到帖子中
-
您还需要更改问题的文本及其标签。实际问题是关于 apache http 服务器和 .htaccess 文件,而不是关于 xml 和 angular。
-
你能看到我现在要做什么吗?
标签: xml apache angular .htaccess