SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Zealot codythebest's Avatar
    Join Date
    Jul 2001
    Location
    Fuerteventura
    Posts
    172
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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?

  2. #2
    SitePoint Wizard rguy84's Avatar
    Join Date
    Sep 2005
    Location
    Durham, NC
    Posts
    1,659
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Do you have some rewrite rules?
    Ryan B | My Blog | Twitter

  3. #3
    SitePoint Zealot codythebest's Avatar
    Join Date
    Jul 2001
    Location
    Fuerteventura
    Posts
    172
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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...

  4. #4
    SitePoint Wizard rguy84's Avatar
    Join Date
    Sep 2005
    Location
    Durham, NC
    Posts
    1,659
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    if you have server/ftp access, make sure you can see hidden files. See if you have an .htaccess file.
    Ryan B | My Blog | Twitter

  5. #5
    SitePoint Zealot codythebest's Avatar
    Join Date
    Jul 2001
    Location
    Fuerteventura
    Posts
    172
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, I have the .htaccess file.

  6. #6
    SitePoint Wizard rguy84's Avatar
    Join Date
    Sep 2005
    Location
    Durham, NC
    Posts
    1,659
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Post the contents of it here
    Ryan B | My Blog | Twitter

  7. #7
    SitePoint Zealot codythebest's Avatar
    Join Date
    Jul 2001
    Location
    Fuerteventura
    Posts
    172
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    # 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

  8. #8
    SitePoint Wizard rguy84's Avatar
    Join Date
    Sep 2005
    Location
    Durham, NC
    Posts
    1,659
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    I have tagged a few members who could help
    Ryan B | My Blog | Twitter

  9. #9
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    8,892
    Mentioned
    138 Post(s)
    Tagged
    2 Thread(s)
    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

    Code:
    # 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

    Code:
    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]
    Rémon - Hosting Advisor

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  10. #10
    SitePoint Zealot codythebest's Avatar
    Join Date
    Jul 2001
    Location
    Fuerteventura
    Posts
    172
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the answer.
    Unfortunately, it made no difference. It still shows 404.

  11. #11
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    8,892
    Mentioned
    138 Post(s)
    Tagged
    2 Thread(s)
    So it doesn't redirect at all? Are you on Apache 1.x or 2.x, do you know that?

    Maybe try this:
    Code:
    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
    Rémon - Hosting Advisor

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •