2014-01-06 13 views
0

我明白谷歌將抓取該網址,並以這種形式向服務器發出請求:的.htaccess重定向_escaped_fragment_ =

http://test1.ru/compare/search.php?r=ade$da1A$ade$da2A$ade$da3A#!hash1.html 
compare.test1.ru/search.php?r=ade$da1A$ade$da2A$ade$da3A#!hash1.html 

http://test1.ru/compare/search.php?r=ade$da1A$ade$da2A$ade$da3A?_escaped_fragment_=hash1.html 
compare.test1.ru/search.php?r=ade$da1A$ade$da2A$ade$da3A?_escaped_fragment_=hash1.html 

服務器路徑爲html http://test1.ru/hash/hash1.html(散/ hash1.html)

需要重定向形式

http://test1.ru/hash/hash1.html 
compare.test1.ru/hash/hash1.html 

沒有改變網址 - compare.test1.ru/search.php?r=ade$da1A$ade$da2A$ade$da3A#!hash1.html

謝謝

+1

我想溝通hashbangs(他們是一個可怕的黑客和加載的初始頁面,然後Ajax加載更換頁面的性能損失可能是討厭的)。改爲使用[歷史api](https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history),就像[github的](https://github.com/blog/760-的樹滑塊)。 – Quentin

回答

1

#!hash1.html永遠不會發送到服務器,因此,有什麼可以在服務器端執行,在PHP中,或使用你的htaccess文件,解析出URL片段。你只能在瀏覽器的最後使用類似javascript的東西來做到這一點。

+0

是在.htaccess 大約有一個短地址,但因爲它是正確的 RewriteEngine敘述在 的RewriteCond%{QUERY_STRING}^_escaped_fragment _ =(。*)$ 重寫規則^(。*)$ /散列/% 1 [NC,L] http://test1.ru/?_escaped_fragment_=hash1.html - 好的! http://test1.ru/compare/search.php?r=ade$da1A$ade$da2A$ade$da3A?_escaped_fragment_=hash1.html - 不! ): – Groomsha