1

What I have

First of all, how I have I have my site set up is the user is brought to the main screen, there is a dropdown menu with links, when a link is clicked it sends an Integer value to a function that sends 2 AJAX calls, 1 that queries a database for a new title and returns it Json encoded, and 1 one that does the same but for associated data. This is then returned, a big div is cleared and a bunch of dom elements are created holding the new data.

What I Need

I have already rewritten my URLs using the #! hashbang. And on the client side when the hash changes it parses out the parameter and sends it via AJAX to the PHP code that executes as normal. The problem is I need to provide a snapshot of the HTML. 90% of examples I find online create the DOM with the PHP code and then just echo back the completed HTML. The code I use to create the HTML DOM is rather complicated so its done on the javascript side. So they recommend the use of a headless browser. But Im on a shared hosting service so I believe I cannot use a headless browser, and if I can I have no idea how to use a php/java bridge to connect the java code to php, create a snapshot, and return it to google.

EDIT: Is it possible just to have .htaccess redirect any _escaped_fragment_ urls to the #! url?

4

1 回答 1

0

您可以使用无头浏览器(例如PhantomJS )预编译所有可能的页面,然后根据 _escaped_fragment_ 值将这些静态 HTML 文件提供给搜索引擎。当然,只有在选项数量受到合理限制的情况下才可行。

于 2014-07-21T22:14:15.097 回答