0

I have an angular app served through nginx. For googlebot I want to serve a different static html file so that it can index properly, is the following nginx config correct? (I don't want to complicate the setup using phantomjs, I want to explore other options like sitemap.xml only if nginx can't do this job)

location / {
    if ($http_user_agent ~ Googlebot) {
        rewrite ^/(.*)$ /forgooglebot.html break;
    }
    root /usr/share/nginx/app;
    try_files $uri $uri/ /index.html;
}

0 Answers0