Prerender io给出404错误 [英] Prerender io giving 404 error

查看:81
本文介绍了Prerender io给出404错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了angulerjs网络应用程序,并为 Angularjs网站之类的每个页面设置了SEO标签不在Google上编制索引

I created an angulerjs web application and set the SEO tags for each pages like Angularjs website not indexing on google

我的Web应用程序托管在IIS服务器中.因此,我将Web配置文件更改为如下配置.

My web application is hosted in IIS server. So I changed my web config file to configure as follows.

<?xml version="1.0"?>
<configuration>
    <system.webServer>
        <httpProtocol>
            <customHeaders>
                <add name="X-Prerender-Token" value="XXXXXXXXXXXXX" />
            </customHeaders>
        </httpProtocol>
        <rewrite>
            <rules>
                <!--# Only proxy the request to Prerender if it's a request for HTML-->
                <rule name="Prerender" stopProcessing="true">
                    <match url="^(?!.*?(\.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|\.m4v|\.torrent))(.*)" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAny">
                        <add input="{HTTP_USER_AGENT}" pattern="baiduspider|facebookexternalhit|twitterbot" />
                        <add input="{QUERY_STRING}" pattern="_escaped_fragment_" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" url="http://service.prerender.io/http://yourwebsite.com/{R:2}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration> 

我使用自己的prerender令牌配置Web配置,并登录到 Prerender.io ,并缓存了我的网站页面

I configure the web config with my own prerender token and logged in to Prerender.io and cached my website pages.

当我加载> http://www.mywebsite.com/?_escaped_fragment_= 时,链接现在给我"404-找不到文件或目录"错误.

When I load http://www.mywebsite.com/?_escaped_fragment_= this link give me "404 - File or directory not found" error now.

推荐答案

我可以通过将Action type Rewrite更改为Redirect来解决此问题.

I could solve this problem by changing Action type Rewrite to Redirect as follows.

<action type="Redirect" url="http://service.prerender.io/http://yourwebsite.com/{R:2}" />

已编辑

但是操作类型重定向"将影响您网站的社交共享.因此,将其保留为Rewrite,并将应用程序请求路由安装到IIS服务器并启用代理.

But action type Redirect will effect to social sharing of your web site. So keep it as Rewrite and install Application Request Routing to the IIS server and enable proxy.

这对某人有帮助:)

这篇关于Prerender io给出404错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆