Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net htaccess 301重定向不起作用_Asp.net_Apache_.htaccess_Redirect - Fatal编程技术网

Asp.net htaccess 301重定向不起作用

Asp.net htaccess 301重定向不起作用,asp.net,apache,.htaccess,redirect,Asp.net,Apache,.htaccess,Redirect,我正在尝试重定向此链接 localhost/Scripts/prodlist.asp?strearch=REMS+POWER+PRESS+E+ATTREZZATURE&strearchtype=OR&strearchmin=0&strearchmax=0&strearchcat=0&curPage=86&sortField=sku 到 本地主机 到目前为止,我尝试了不同的方法,但都没有成功。现在我在这里: RewriteEngine On RewriteCond %{QUERY_STRI

我正在尝试重定向此链接

  • localhost/Scripts/prodlist.asp?strearch=REMS+POWER+PRESS+E+ATTREZZATURE&strearchtype=OR&strearchmin=0&strearchmax=0&strearchcat=0&curPage=86&sortField=sku

  • 本地主机
到目前为止,我尝试了不同的方法,但都没有成功。现在我在这里:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^(strSearch=TRE+ESSE+TRE+IDROSELF+BIDET+WC+SOSPESO+IDEAL+STANDARD+SERIE+21+STEP+SANITARI+CERAMICA+PIATTO+DOCCIA+EDRAULICA)$
RewriteRule ^Scripts/prodlist\.asp$ localhost [R=301,L]

但我仍然收到404错误。有人能帮我解决这个问题吗?

您的链接与您试图在
.htaccess
代码段中捕获的查询字符串不匹配。此外,您还尝试从外部重定向到
localhost
,这将被解析为
http://example.com/localhost

我能想出的最好的方法来匹配你的原始链接,如下所示

RewriteCond %{QUERY_STRING} ^strSearch=(.+)&strSearchType=(.+)&strSearchMin=(.+)&strSearchMax=(.+)&strSearchCat=(.+)&curPage=(.+)&sortField=(.+)$
RewriteRule ^Scripts/prodlist\.asp$ http://example.com/ [L,R=301]
但是,您可以只指定完整的查询字符串,而不使用常规捕获模式:

RewriteCond %{QUERY_STRING} ^strSearch=REMS+POWER+PRESS+E+ATTREZZATURE&strSearchType=OR&strSearchMin=0&strSearchMax=0&strSearchCat=0&curPage=86&sortField=sku$
RewriteRule ^Scripts/prodlist\.asp$ http://example.com/ [L,R=301]

您的链接与您试图在
.htaccess
代码段中捕获的查询字符串不匹配。此外,您还尝试从外部重定向到
localhost
,这将被解析为
http://example.com/localhost

我能想出的最好的方法来匹配你的原始链接,如下所示

RewriteCond %{QUERY_STRING} ^strSearch=(.+)&strSearchType=(.+)&strSearchMin=(.+)&strSearchMax=(.+)&strSearchCat=(.+)&curPage=(.+)&sortField=(.+)$
RewriteRule ^Scripts/prodlist\.asp$ http://example.com/ [L,R=301]
但是,您可以只指定完整的查询字符串,而不使用常规捕获模式:

RewriteCond %{QUERY_STRING} ^strSearch=REMS+POWER+PRESS+E+ATTREZZATURE&strSearchType=OR&strSearchMin=0&strSearchMax=0&strSearchCat=0&curPage=86&sortField=sku$
RewriteRule ^Scripts/prodlist\.asp$ http://example.com/ [L,R=301]

我尝试使用完整的查询,但不起作用。我还用localhost替换了站点,实际的链接类似于http://www.example.com/Scripts/prodlist.asp?strearch=REMS+POWER+PRESS+E+ATTREZZATURE&strearchType=OR&strearchmin=0&strearchmax=0&strearchcat=0&curPage=86&sortField=sku。我尝试使用完整的查询,但不起作用。我还用localhost替换了站点,实际的链接类似于http://www.example.com/Scripts/prodlist.asp?strearch=REMS+POWER+PRESS+E+ATTREZZATURE&strearchType=或&strearchmin=0&strearchmax=0&strearchcat=0&curPage=86&sortField=sku。我可以使用以下配置: