2017-03-17 138 views

回答

0

你可以使用国防部别名:

Redirect 301 /path/?start=10 /new-path/ 

或者使用mod_rewrite

RewriteEngine On 
RewriteCond %{HTTPS} !on 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 
RewriteRule ^/path/?start=10$ /new-path/$1 [L,R=301] 
+0

我需要它重定向到https在同一时间。 –

+0

使用mod_rewrite,答案更新 –

2

不能RedirectMatch重定向的queryString,你需要使用重写规则用于此目的:

RewriteEngine on 

RewriteCond %{THE_REQUEST} /path/\?start=10 
RewriteRule^https://example.com/new-path? [L,R] 

目标网址末尾的空白问号对于丢弃新网址中的旧查询字符串很重要。如果省略,mod重写会将querystring附加到目标url,您的url将看起来像http://example.com/new-path?test=10

相关问题