2014-07-16 51 views
0

我的要求會像/insights/papers-articles.html?view=papers & P = 10 &/ABCDEFGH & indcal = 1 當我打這個URL,將其重定向我到/insights/papers-articles/papers-abcdefgh-3.html無法獲得在htacces查詢字符串參數

我想indcal參數,以便網址將/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」參數不在,請幫忙。

TIA。

這是完整的規則

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] 

最後一條規則是上面的查詢。

+0

規則看起來不錯,只是測試在一個單獨的瀏覽器。 – anubhava

+0

anubhava它重定向在/insights/papers-articles/papers-abcdefgh-10.html not /insights/papers-articles/papers-abcdefgh-10.html?indcal=1 – user3544922

+0

不,它工作正常,並重定向到'/見解/論文 - 文章/論文-abcdefgh-10.html?indcal = 1'我已經測試過了。 – anubhava

回答

0

重新安排你的規則是這樣的:

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] 
+0

anubhava它不工作是否有任何替代 – user3544922