SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    Visible Ninja bronze trophy
    JeffWalden's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,709
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    WordPress blog is turning up 301 redirect.

    My WordPress blog seems to be returning a 301 redirect for Googlebot but it seems to be working fine in the browsers. Within Google Webmaster Tools I fetched my site (www.brandculture.com/blog) as Googlebot and this is what was returned:

    Code:
    HTTP/1.1 301 Moved Permanently
    Date: Sun, 17 Jan 2010 17:49:46 GMT
    Server: Apache/2.0.54
    Location: http://www.brandculture.com/blog/
    Vary: Accept-Encoding
    Content-Encoding: gzip
    Content-Length: 242
    Keep-Alive: timeout=5, max=100
    Connection: Keep-Alive
    Content-Type: text/html; charset=iso-8859-1
    
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html><head>
    <title>301 Moved Permanently</title>
    </head><body>
    <h1>Moved Permanently</h1>
    <p>The document has moved <a href="http://www.brandculture.com/blog/">here</a>.</p>
    <hr>
    <address>Apache/2.0.54 Server at www.brandculture.com Port 80</address>
    </body></html>
    However, if I view this in the the browser I'm seeing the blog just fine without a redirect of any kind. Why is the server doing this 301?

    Here is my .htaccess file:

    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
    TAKE A WALK OUTSIDE YOUR MIND.

  2. #2
    Visible Ninja bronze trophy
    JeffWalden's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,709
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    I forgot about the .htaccess file in the web root. When I commented out this:

    Code:
    #RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
    #RewriteRule ^(.*)index\.php$ http://www.brandculture.com/$1 [R=301,L]
    #AddHandler php5-script .php
    The individual pages such as /blog/index.php seem to load without the 301 but /blog still produces a 301. Again, everything works correctly in the browser. It's just Googlebot that's seeing this. Here's the root .htaccess file:

    Code:
    RewriteEngine on
    
    Options +FollowSymLinks
    RewriteCond %{HTTP_HOST} ^brandculture.com$
    RewriteRule ^(.*)$ http://www.brandculture.com/$1 [R=301,L]
    
    #RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
    #RewriteRule ^(.*)index\.php$ http://www.brandculture.com/$1 [R=301,L]
    #AddHandler php5-script .php
    
    Redirect 301 /blog/about http://www.brandculture.com/blog/about-2
    TAKE A WALK OUTSIDE YOUR MIND.

  3. #3
    Visible Ninja bronze trophy
    JeffWalden's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,709
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Sorry for all the replies - just learning more about this as I go. I've just tried the same thing on a completely different domain with the same directory structure and getting the same results. This appears to be more of a WordPress thing. Has anyone ever experienced this before?
    TAKE A WALK OUTSIDE YOUR MIND.

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,604
    Mentioned
    19 Post(s)
    Tagged
    2 Thread(s)
    Hyper,

    The Redirect (301) will take precedence over all mod_rewrite directives.

    THAN the non-www to www will also produce a 301 code for you.

    The remaining mod_rewrite will not.

    What is your TEST URL?

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  5. #5
    Visible Ninja bronze trophy
    JeffWalden's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,709
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    I'm testing both:

    www.brandculture.com/blog (Googlebot shows 301)
    www.brandculture.com/blog/index.php (Googlebot does not show 301)
    TAKE A WALK OUTSIDE YOUR MIND.

  6. #6
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,604
    Mentioned
    19 Post(s)
    Tagged
    2 Thread(s)
    Hyper,

    A closer look:
    Code:
    RewriteEngine on
    
    Options +FollowSymLinks
    RewriteCond &#37;{HTTP_HOST} ^brandculture.com$
    RewriteRule ^(.*)$ http://www.brandculture.com/$1 [R=301,L]
    
    #RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
    #RewriteRule ^(.*)index\.php$ http://www.brandculture.com/$1 [R=301,L]
    #AddHandler php5-script .php
    
    Redirect 301 /blog/about http://www.brandculture.com/blog/about-2
    There's NOTHING there that even affects blog or blog/index.php. The only "redirection" is Apache recognizing that blog is a directory rather than a file and find the first DirectoryIndex it can (index.php) to serve. I wouldn't call that a 301 but your bot seems to think otherwise.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  7. #7
    Visible Ninja bronze trophy
    JeffWalden's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,709
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Thanks David. I didn't see a 301 in that .htaccess file either but Googlebot seems to be saying otherwise.

    I guess I'll just wing it and see what happens.

    -Jeff
    TAKE A WALK OUTSIDE YOUR MIND.


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
  •