How to benefit of prerender.io services if my Apache server doesn't allow a proxy
Having an Angular app, I want to benefit of an HTML prerendering for Search engines bots.
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>
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_=
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.
Is there any workaround to to benefit of prerender.io with Apache and .htaccess configuration without switching to a dedicated Apache Server?
Is the proxy flag mandatory?
Answer
The proxy flag is mandatory because a redirect would incorrectly tell the crawlers to send your users to the redirected site instead.
Related Questions
- → Make a Laravel collection into angular array (octobercms)
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → Angularjs not working inside laravel form
- → Analysis of Flux implementations
- → how to write react component to construct HTML DOM
- → angular ng-repeat and images in a row
- → Conditional BG Color on AngularJS
- → Should I 'use strict' for every single javascript function I write?
- → getting the correct record in Angular with a json feed and passed data
- → "Undefined is not a function" at .toBe fucntion
- → angularjs data binding issue
- → Angular / JavaScript auto hydrate an instance
- → Convert generic text string in json object into valid url using Angular