Wordpress 404 problem

I have a blog indexed in G.
But all the indexed pages named : mysite.com/blog/search/article-title/ return a 404.

mysite.com/blog/article-title/ is working OK. I don’t have any search file though. Maybe that’s the problem.

Anyone knows how to fix this?

Do you have some rewrite rules?

Not sure. I’m using WP since a while already but just noticed that the indexed article pages URL including /search/ return a 404, but not the others like /tag/ etc…

if you have server/ftp access, make sure you can see hidden files. See if you have an .htaccess file.

Yes, I have the .htaccess file.

Post the contents of it here

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>

# END WordPress

I have tagged a few members who could help

Okay so if I understand this correctly you want to remove /search/ from the URL when it’s there. That’s simple enough using mod_rewrite.

First though, let’s have a look at your .htaccess


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>

# END WordPress

You should drop the <IfModule mod_rewrite.c> and </IfModule>, you don’t need it; it just slows thing down for nothing.
You can probably drop the RewriteBase as well; just try it and put it back if it doesn’t work.

As for your request, try this


RewriteEngine On

RewriteRule ^blog/search/([a-zA-Z0-9-]+)/?$ /blog/$1/ [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]

Thanks for the answer.
Unfortunately, it made no difference. It still shows 404.

So it doesn’t redirect at all? Are you on Apache 1.x or 2.x, do you know that?

Maybe try this:


RewriteEngine On

RewriteRule ^/?blog/search/([a-zA-Z0-9-]+)/?$ /blog/$1/ [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]

To be clear, this should redirect from blog/search/whatever, to blog/whatever