2016-10-26 73 views
0

我想抓住網址,檢查網址是否包含「#!」並重定向到沒有「#!」的相同網址串?我嘗試了以下 - 但這不起作用?apache國防部重寫條件 - 規則

RewriteCond %{REQUEST_URI} "(.*).html#!$" 
RewriteRule "(.*)" $1 [NC,L,R=301] 

回答

0

嘗試一個:

RewriteCond %{REQUEST_URI} ".*\.html#!$" 
RewriteRule "^(.*\.html)#!$" $1 [NC,L,R=301] 
+0

也不工作 - 安迪的想法? – heppi75

0

不幸的是,以前的解決方案是錯誤的。服務器不會處理網格符號後的數據:

[27/Oct/2016:10:23:12 +0300] domain.com xx.xx.xx.xx xx.xx.xx.xx 200 0 0.000 HEAD /index.html HTTP/1.1 - curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3 

$ curl -I 'http://domain.com/index.html#!1asfasgf1ghgh' 
HTTP/1.1 200 OK 
Server: nginx/1.10.1 
Date: Thu, 27 Oct 2016 07:23:14 GMT 
Content-Type: text/html; charset=UTF-8 
Content-Length: 9977 
Connection: keep-alive 
Last-Modified: Sat, 23 Jan 2016 14:06:07 GMT 
ETag: "a66b6-26f9-52a00d64891c0" 
Accept-Ranges: bytes 
Vary: Accept-Encoding