Last active
December 27, 2019 05:25
-
-
Save thoop/6be274259bdeee4e2363e008577bff2a to your computer and use it in GitHub Desktop.
Prerender.io IIS web.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rules> | |
<!--# Only proxy the request to Prerender if it's a request for HTML--> | |
<rule name="Prerender" stopProcessing="true"> | |
<serverVariables> | |
<set name="HTTP_X_PRERENDER_TOKEN" value="[...your token...]" /> | |
</serverVariables> | |
<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="googlebot|bingbot|yandex|baiduspider|twitterbot|facebookexternalhit|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest|slackbot|vkShare|W3C_Validator" /> | |
<add input="{QUERY_STRING}" pattern="_escaped_fragment_" ignoreCase="false" /> | |
</conditions> | |
<action type="Rewrite" url="https://service.prerender.io/https://yourwebsite.com/{R:2}" /> | |
</rule> | |
</rules> | |
</rewrite> | |
</system.webServer> | |
</configuration> |
There are also two other very important details we learned for using prerender.io with IIS:
- Install the ARR
- Check the ARR Enable Proxy flag otherwise, Rewrite to any external site will return 404
hi
i had update my angular 8 website web.config file with the above rules but still my site pagesource not showing seo details
please help me regarding this.
my link is
http://oncloudinfotech.info/
Modified web.config
<rule name="Angular Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/index.html" />
</rule>
<rule name="Prerender" stopProcessing="true">
<serverVariables>
<set name="HTTP_X_PRERENDER_TOKEN" value="xxxxx" />
</serverVariables>
<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="googlebot|bingbot|yandex|baiduspider|twitterbot|facebookexternalhit|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest|slackbot|vkShare|W3C_Validator" />
<add input="{QUERY_STRING}" pattern="_escaped_fragment_" ignoreCase="false" />
</conditions>
<action type="Rewrite" url="https://service.prerender.io/http://oncloudinfotech.info/{R:2}" />
</rule>
</rules>
</system.webServer>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You also need to add
HTTP_X_PRERENDER_TOKEN
to the Allowed Server Variables in IIS for the prerender token to be sent correctly to our prerender.io service.