简体   繁体   English

Nginx:重定向搜索301

[英]Nginx: Redirect search 301

I'm using nginx and i found in my panel multiple 404 errors for searches, because i migrated joomla to wordpress. 我正在使用nginx,并且在我的面板中发现多个404错误进行搜索,因为我将joomla迁移到了wordpress。

I need make a rewrite in nginx but i need help to do.. 我需要在Nginx中进行重写 ,但是我需要帮助。

Eg: 例如:

404 URL: 404网址:

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

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

Would be: 将会:

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

Nginx: Nginx的:

server {

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

If the URIs /component/search/ and /component/content/ are unique to the previous implementation, setting up two prefix locations may be the most efficient solution: 如果URI /component/search//component/content/对于先前的实现是唯一的,则设置两个前缀位置可能是最有效的解决方案:

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM