Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an ajax webapp i'd like to make indexable to google.

My paths use the hashbang, and look like:

http://tld.com/?_escaped_fragment_en/news
http://tld.com/?_escaped_fragment_de/news

or

http://tld.com/?_escaped_fragment_en/news/news-item-name
http://tld.com/?_escaped_fragment_de/news/news-item-name

Considering the infinite ways of the web, it could also be that my URLS look like the following:

http://tld.com/index.html?_escaped_fragment_en/news/news-item-name

or

http://tld.com/index?_escaped_fragment_en/news/news-item-name

I have files that contain the markup as should be visible by the search engines in a folder called "fragments" which is at the root level of the website's documentroot.

These are organized by folders, such as:

/fragments/en/ -> containing a file called news 

or

/fragments/en/ -> /news , containg a file called news-item-name 

Google requests the files as ?_escaped_fragment_ , as according to https://developers.google.com/webmasters/ajax-crawling/docs/specification.

I need to create apache rewrite rules, that map a request for , for example,

http://tld.com/index.html?_indexed_fragment=en/news/news-item-name

to the according file on my filesystem (/fragments/en/news/news-item-name), so that the snapshot can be served to the crawler.

I've currently got the following rules in place:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=(.*)$
RewriteRule ^$ /fragments/%1

These unfortunately are not able to deal with the folder structure, and they just look for a file in the fragments directory.

share|improve this question
    
Solved the issue. RewriteCond %{QUERY_STRING} ^_escaped_fragment_=(.*)$ RewriteRule ^(.*) /fragments/%1 did the trick. –  user436118 Nov 5 '12 at 14:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.