gpt4 book ai didi

php - htaccess 中带有 _escaped_fragment_ 的可抓取 AJAX

转载 作者:可可西里 更新时间:2023-11-01 13:23:19 25 4
gpt4 key购买 nike

各位开发者大家好!

我们即将完成 ajax 网络应用程序第一阶段的开发。在我们的应用程序中,我们使用的哈希片段如下:

http://ourdomain.com/#!list=last_ads&order=date

我知道谷歌会获取这个 url 并以这种形式向服务器发出请求:

http://ourdomain.com/?_escaped_fragment_=list=last_ads?order=date&direction=desc

一切都很完美,除了...

我想将这种请求路由到另一个脚本

像这样:

RewriteCond %{QUERY_STRING} ^_escaped_fragment_=(.*)$
RewriteRule ^$ /webroot/crawler.php$1 [L]

问题是,当我尝试在 crawler.php 中打印_r($_REQUEST) 时,我只得到:

Array
(
[_escaped_fragment_] => list=last_ads?order=date
[direction] => desc
)

我想得到的是

Array
(
[list] => last_ads
[order] => date
[directions] => des
)

我知道我可以使用 php 进一步打破第一个参数,但我不想 ;)

请指教

============================================= =====编辑...对文本和逻辑进行一些更正

最佳答案

你忘记了 QSA 指令(每个人都错过了重点 =D )

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

顺便说一下,您的 $1 是错误的……没用,因为它没有引用任何内容。所以这应该是:

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

告诉我这是否有效。

关于php - htaccess 中带有 _escaped_fragment_ 的可抓取 AJAX,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8063287/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com