的從URL shows.php?id=review-1
導向創建一個搜索引擎友好的URL,並使用301重定向進一步重定向服務器端控制文件下列RewriteRule
轉發流量。使用CURL
,重定向到控制器文件顯示爲200,直接鏈接到控制器文件顯示301重寫規則返回HTTP 200時,它應該是HTTP 301
這裏是我的RewriteRule
:
RewriteCond %{THE_REQUEST} ^GET\s/shows\.php\?
RewriteCond %{QUERY_STRING} (^|&)id=review-[0-9]+(&|$) [NC]
RewriteRule^/controllers/redirectseo.php? [R=301,L,NC,QSA]
這裏是我的CURL
調用結果:
curl -I http://www.defunctgames.com/shows.php?id=review-1
HTTP/1.1 200 OK
curl -I http://www.defunctgames.com/controllers/redirectseo.php?id=review-1
HTTP/1.1 301 Moved Permanently
更新1:
我試着修改我的RewriteRule
擺脫[QSA]
,認爲也許這是問題。它仍然不會返回301.下面的重寫規則會返回301,所以我知道它在某種程度上有效。 FQL可能會有所作爲嗎?
RewriteRule ^defunctexplorer.htm$ http://www.defunctgames.com/ [R=301,L]
更新2:
我嘗試了FQL重定向,並且不有所作爲無論是。下面是我到目前爲止有:
RewriteCond %{THE_REQUEST} ^GET\s/shows\.php
RewriteCond %{QUERY_STRING} (^|&)id=([a-z]+)-([0-9]+)(&|$) [NC]
RewriteRule^http://www.defunctgames.com/controllers/redirectseo.php?id=%2-%3 [R=301,L,NC]
嗨。你找到解決方案嗎?我已經應用了301重定向,它似乎可以工作,但使用curl它說「200代碼響應」。 – JCarlos 2017-08-07 16:10:18