wtfroland
wtfroland

Reputation: 31

Properly redirect _escaped_fragment_ of a sub-site

As stated from the title, I am trying to redirect my ajax driven subsite's google _escaped_fragment_ query to its correct url (/crawler folder that feeds the html snapshots). Right now my .htaccess configuration is this:

# google crawl rules
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=(.*)$
RewriteRule ^$ /crawler/index.php?_escaped_fragment_= [QSA,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

This correctly redirects the main site mysite.com/page/subpage/ to mysite.com/?_escaped_fragment_=page/subpage. What I need to do now is to redirect mysite.com/french/page/subpage/ to mysite.com/french/?_escaped_fragment_=page/subpage

Upvotes: 1

Views: 1071

Answers (1)

wtfroland
wtfroland

Reputation: 31

Was able to solve it using these rules:

RewriteCond %{QUERY_STRING}/ ^_escaped_fragment_=(.*)$
RewriteRule ^([a-z0-9\-]+)/$ /crawler/index.php?seo_q=%1 [QSA,L]

RewriteCond %{QUERY_STRING} ^_escaped_fragment_=(.*)$
RewriteRule ^$ /crawler/index.php?seo_q=%1 [QSA,L]

Upvotes: 2

Related Questions