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.

I need make a rewrite in nginx but i need help to do..

Read More

Eg:

404 URL:

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:

server {

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

Related posts

1 comment

  1. 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:

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

Comments are closed.