如何受益prerender.io服务,如果我的Apache服务器不允许代理 [英] How to benefit of prerender.io services if my Apache server doesn't allow a proxy

查看:181
本文介绍了如何受益prerender.io服务,如果我的Apache服务器不允许代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

具有角的应用程序,我想受益的HTML prerendering的搜索引擎机器人的。

Having an Angular app, I want to benefit of an HTML prerendering for Search engines bots.

下面是我的.htaccess配置:

Here's my .htaccess configuration:

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

    <IfModule mod_rewrite.c>
        Options +FollowSymlinks
        RewriteEngine on

                <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_

            # Only proxy the request to Prerender if it's a request for HTML
                      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|\.m4v|\.torrent|\.ttf|\.woff))(.*) http://service.prerender.io/http://example.com/$2 [P,L]
               </IfModule>


                # Don't rewrite files or directories
                RewriteCond %{REQUEST_FILENAME} -f [OR]
                RewriteCond %{REQUEST_FILENAME} -d
                RewriteRule ^ - [L]

                # Rewrite everything else to index.html to allow html5 state links
                RewriteRule ^ index.html [L]
    </IfModule>

我的问题是,涉及代理 P 标志导致403错误:结果
您没有权限访问/结果
当我运行以下命令:结果
卷曲http://example.com?_escaped_fragment_=

My issue is that the P flag involving proxy causes a 403 error:
"You don't have permission to access /"
when I run the following command:
curl http://example.com?_escaped_fragment_=

我没有自己的专用服务器,但外部共享的Apache服务器。
我接触此服务器实例的支持,他们认为,代理共享实例是被禁止的,从而导致错误403

I don't own a dedicated server but an external shared Apache server. I contacted the support of this server instance and they argue that proxy are forbidden on shared instances, resulting in an error 403.

有任何解决方法对不切换到一个专用的Apache服务器?

Is there any workaround to to benefit of prerender.io with Apache and .htaccess configuration without switching to a dedicated Apache Server?

是代理标志强制性?

推荐答案

代理标志是强制性的,因为重定向会错误地告诉爬虫用户发送重定向的站点来代替。

The proxy flag is mandatory because a redirect would incorrectly tell the crawlers to send your users to the redirected site instead.

这篇关于如何受益prerender.io服务,如果我的Apache服务器不允许代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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