站点主页未重定向到prerender.io

时间:2017-07-21 02:52:38

标签: angularjs .htaccess prerender

使用Angular 1.5构建一个使用prerender.io到服务器页面的网站。在大多数情况下,它运行良好,但是,该网站的主页似乎没有重定向到预渲染,这导致我一些问题。我的angular文件索引的路径是/templates/index.html。

<IfModule mod_headers.c>
    RequestHeader set X-Prerender-Token "xxxxxxxxxxxxxxxx"
</IfModule>

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^.*$ - [NC,L]

<IfModule mod_proxy_http.c>

    RewriteCond %{HTTP_USER_AGENT} baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest|slackbot|vkShare|W3C_Validator [NC,OR]
    RewriteCond %{QUERY_STRING} _escaped_fragment_

    RewriteRule ^(?!.*?(\.js|\.css|\.xml|\.less|\.png|\.jpg|\.jpeg|\.gif|\.pdf|\.doc|\.txt|\.ico|\.rss|\.zip|\.mp3|\.rar|\.exe|\.wmv|\.doc|\.avi|\.ppt|\.mpg|\.mpeg|\.tif|\.wav|\.mov|\.psd|\.ai|\.xls|\.mp4|\.m4a|\.swf|\.dat|\.dmg|\.iso|\.flv|\.torrent|\.ttf|\.woff|\.svg|\.eot|\.woff2))(.*) http://service.prerender.io/https://www.example.com/$2 [P,L]

    RewriteCond %{HTTP_HOST} ^www\. [NC]
    RewriteRule ^(.+)\.xml$ http://content.example.com/$1.xml [P]
</IfModule>

RewriteRule ^(.*) templates/index.html [NC,L]

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



Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET,POST,PUT,OPTIONS"
Header set Access-Control-Allow-Credentials "true"

使用htaccess或httpd.conf不太好。从另一个开发者那里接过这个。任何帮助都会有很大的帮助。

0 个答案:

没有答案