Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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
.htaccess 无法在htacces中的查询字符串中获取参数_.htaccess - Fatal编程技术网

.htaccess 无法在htacces中的查询字符串中获取参数

.htaccess 无法在htacces中的查询字符串中获取参数,.htaccess,.htaccess,我的请求是/insights/papers articles.html?view=papers&p=10&/abcdefgh&indcal=1 当我点击这个url时,它将我重定向到/insights/papers-articles/papers-abcdefgh-3.html 我需要indcal参数,所以url将是/insights/papers-articles/papers-abcdefgh-10.html?indcal=1 我使用了以下规则: RewriteCond %{THE_REQUE

我的请求是/insights/papers articles.html?view=papers&p=10&/abcdefgh&indcal=1 当我点击这个url时,它将我重定向到/insights/papers-articles/papers-abcdefgh-3.html

我需要indcal参数,所以url将是/insights/papers-articles/papers-abcdefgh-10.html?indcal=1

我使用了以下规则:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(insights)/(papers-articles)\.html\?view=([^&\s]+)&p=([^&\s]+)&/([^&\s]+)&indcal=([0-9]+) [NC]
RewriteRule ^ /%1/%2/%3-%5-%4.html\?indcal=%6 [R=301,L]
但indcal参数未提交,请帮助

蒂亚

这是完整的规则

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(insights)/(papers-articles)\.html\?view=([^&\s]+)&p=([^&\s]+)&/([^&\s]+)$ [NC]
RewriteRule ^ /%1/%2/%3-%5-%4.html? [R=301,L]


RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(insights)/(papers-articles)\.html\?view=([^&\s]+)&p=([^&\s]+)&title=([^&\s]+) [NC]
RewriteRule ^ /%1/%2/%3-%5-%4.html? [R=301,L]


RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(insights)/(papers-articles)\.html\?view=([^&\s]+)&q=([^&\s]+)&/([^&\s]+) [NC]
RewriteRule ^ /%1/%2/%3-%5-%4.html? [R=301,L]


RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(insights)/(papers-articles)\.html\?view=([^&\s]+)&q=([^&\s]+)&title=([^&\s]+) [NC]
RewriteRule ^ /%1/%2/%3-%5-%4.html? [R=301,L]


RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(insights)/(papers-articles)\.html\?p=([^&\s]+)&/([^&\s]+) [NC]
RewriteRule ^ /%1/%2/papers-%4-%3.html? [R=301,L]


RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(insights)/(papers-articles)\.html\?view=([^&\s]+)&p=([^&\s]+)&/([^&\s]+)&indcal=([0-9]+) [NC]
RewriteRule ^ /%1/%2/%3-%5-%4.html\?indcal=%6 [R=301,L]

最后一条规则用于上述查询。

按如下方式重新排列规则:

RewriteEngine On

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(insights)/(papers-articles)\.html\?view=([^&\s]+)&p=([^&\s]+)&/([^&\s]+)&indcal=([0-9]+) [NC]
RewriteRule ^ /%1/%2/%3-%5-%4.html\?indcal=%6 [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(insights)/(papers-articles)\.html\?view=([^&\s]+)&p=([^&\s]+)&/([^&\s]+)$ [NC]
RewriteRule ^ /%1/%2/%3-%5-%4.html? [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(insights)/(papers-articles)\.html\?view=([^&\s]+)&p=([^&\s]+)&title=([^&\s]+) [NC]
RewriteRule ^ /%1/%2/%3-%5-%4.html? [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(insights)/(papers-articles)\.html\?view=([^&\s]+)&q=([^&\s]+)&/([^&\s]+) [NC]
RewriteRule ^ /%1/%2/%3-%5-%4.html? [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(insights)/(papers-articles)\.html\?view=([^&\s]+)&q=([^&\s]+)&title=([^&\s]+) [NC]
RewriteRule ^ /%1/%2/%3-%5-%4.html? [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(insights)/(papers-articles)\.html\?p=([^&\s]+)&/([^&\s]+) [NC]
RewriteRule ^ /%1/%2/papers-%4-%3.html? [R=301,L]

规则看起来不错,只需在单独的浏览器中进行测试。anubhava它正在/insights/papers articles/papers-abcdefgh-10.html上重定向,而不是/insights/papers articles/papers-abcdefgh-10.html?indcal=1它工作正常,并重定向到/insights/papers articles/papers-abcdefgh-10.html?indcal=1我已经在不同的浏览器上进行了检查,没有工作,我还清除了历史。有没有其他的规则,也就是说你还有其他的规则。发布您的完整.htaccess