Ad

Prerender.io Not Working When Redirecting Root Path With Apache Mod Rewrite

- 1 answer

I am trying to redirect my root path www.example.com to www.example.com/en/ But when I use this the root path for prerender redirects too.

So for example when I go to this www.example.com/?_escaped_fragment_= it redirects directly to www.example.com/en/ instead of www.example.com/en/?_escaped_fragment_=

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} example\.com [NC]
RewriteCond %{REQUEST_URI} ^/$
Rewriterule ^(.*)$ http://www.example.com/en/ [L,R=301]
</IfModule>

Please help thank you.

Ad

Answer

That is expected and working correctly.

If a user goes to www.example.com/ then they should get redirected to www.example.com/en/.

So if a crawler goes to www.example.com/?_escaped_fragment_= then they should also get redirected to www.example.com/en/.

The crawler will update their index and they will eventually crawl www.example.com/en. If they find the meta fragment tag then they will crawl www.example.com/en/?_escaped_fragment_=.

So that's just all part of the process of the escaped fragment crawling scheme.

Ad
source: stackoverflow.com
Ad