[英]Redirect from page without parameters to page with parameters in htaccess
[英].htaccess redirect without query parameters
我更改了網站,現在Google網站管理員正在加載數百個“未找到” URL:
http://www.domain.com/images/picture.php?idphotos=720,404,,4/1/13,Not found
picture.php不再存在,所以我創建了一個.htaccess條目來重定向網站的根目錄:
Redirect 301 /images/picture.php. /
現在的問題是所有查詢參數也都在重定向中發送:
http://www.domain.com/?idphotos=720
如何創建不包含查詢參數的重定向,例如:
http://www.domain.com/
試試這個(注意尾隨的?
):
RewriteCond %{QUERY_STRING} !=""
RewriteRule . http://www.domain.com/?
或者使用Apache 2.4.0中的QSD標志
RewriteCond %{QUERY_STRING} !=""
RewriteRule . http://www.domain.com/ [L,R=301,QSD]
http://httpd.apache.org/docs/current/en/rewrite/flags.html#flag_qsd
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.