I've search a few days but still have a problem with htaccess file to install prerender.io Token. I've got this message after saving and testing all kind of htaccess formats:
We haven't seen a request with your Prerender token yet. Click here to see how to install the token in your middleware.
Actually all pages are cached! My project is Reactjs and Codeigntier with shared host on Apache.
I have a htaccess file like so:
# this section for forcing https and www
RewriteEngine On
RewriteCond %{HTTPS} !^on$
RewriteRule (.*) https://www.mokaab.com/$1 [R,L]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
# this is the code which provided on Prerender website
<IfModule mod_headers.c>
RequestHeader set X-Prerender-Token "TOKEN"
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
<IfModule mod_proxy_http.c>
RewriteCond %{HTTP_USER_AGENT} googlebot|bingbot|yandex|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/https://www.mokaab.com/$2 [P,L]
</IfModule>
</IfModule>
# this is for avoiding 404 page when refreshing page on React apps
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]
Furthermore I've changed their places but still have a problem! Then I put following meta tag in Head section :
<meta name="fragment" content="!">
I think the problem is about htaccess.
The .htaccess
file was correct! The problem is for configuration in host!
These configuration must be enable on every type of host :
mod_headers.c
mod_rewrite.c
mod_proxy_http.c
Obviously the first two option are enable on normal host but the last one need SSH
which is unavailable!