2016-02-03 64 views
1

我使用nginx的我在面板多發現404錯誤進行搜索,因爲我的Joomla遷移到WordPress。Nginx的:重定向搜索301

我需要做一個重寫在nginx的,但我需要幫助做..

如:

404網址:

http://example.com/component/search/?searchword=shoes&ordering=&searchphrase=all 

http://example.com/component/content/?view=featured&start=220 

是:

http://example.com/?s=shoes 
http://example.com 

Nginx的:

server { 

    #Other server configs... 
    rewrite ^component/search/?searchword=$ http://example.com/?s= permanent; 
} 

回答

0

如果URI的/component/search//component/content/是獨一無二的以前的實現,設置了兩個前綴位置可能是最有效的解決方案:

location /component/search/ { 
    return 301 $scheme://$host/?s=$arg_searchword; 

location /component/content/ { 
    return 301 $scheme://$host/; 
} 
+0

THX,理查德!作品! – user2925795