Wordpress .htacess problem

Discussion in 'WordPress' started by ruin7xx, Sep 2, 2007.

  1. #1
    Some are my pages in google are indexed as:

    http://www.mydomain.com/page/

    AND

    http://mydomain.com/page/

    I tried to do a force redirect in order to avoid duplicate content using this .htaccess:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    #
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$ [NC]
    RewriteRule ^(.*)$ http://mydomain.com/$1 [L,R=301]

    # END WordPress

    The problem is that have both rewrite rules (SEO rewrite & force www to non-www) causes a page such as mydomain.com/page/ to redirect to mydomain.com/index.php

    Is there a way to have the redirects not interfere with each other?
     
    ruin7xx, Sep 2, 2007 IP
  2. mann3r

    mann3r Peon

    Messages:
    1,416
    Likes Received:
    100
    Best Answers:
    0
    Trophy Points:
    0
    #2
    thus mydomain.com/page/ exist?
     
    mann3r, Sep 2, 2007 IP
  3. r3born

    r3born Active Member

    Messages:
    1,070
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    88
    #3
    r3born, Sep 2, 2007 IP
  4. Noddegamra

    Noddegamra Peon

    Messages:
    1,013
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I just installed it. Just what I needed :)
     
    Noddegamra, Sep 3, 2007 IP
  5. VimF

    VimF Well-Known Member

    Messages:
    307
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    118
    #5
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.mydomain\.com [NC]
    RewriteRule ^(.*)$ http://mydomain.com/$1 [L,R=301]
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
     
    VimF, Sep 3, 2007 IP
  6. ruin7xx

    ruin7xx Guest

    Messages:
    110
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    plugin works well thanks
     
    ruin7xx, Sep 3, 2007 IP
  7. alcam

    alcam Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I've been having a problem with this plugin. It works great; I check it a few hours later and it has stopped working. I am also running wp-cache manager.

    When I go into the cache manager and clear the cached pages it starts working again for a while anyway. Rinse and repeat.

    Can someone enlighten me? Thanks
     
    alcam, Sep 14, 2007 IP
  8. Jasonb

    Jasonb Well-Known Member

    Messages:
    4,486
    Likes Received:
    151
    Best Answers:
    0
    Trophy Points:
    195
    #8
    im having the same problem :(
     
    Jasonb, Sep 14, 2007 IP
  9. alcam

    alcam Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    If I disable the caching, clear the cached pages, and then deactivate the plugin my problem is fixed. I really don't see a big performance drop on the site with wp-cache off so, for now I am just going to leave it. I'll have to look into why these plugins conflict with each other later.

    If anyone has a work around please post. thanks.
     
    alcam, Sep 16, 2007 IP
  10. poseidon

    poseidon Banned

    Messages:
    4,356
    Likes Received:
    246
    Best Answers:
    0
    Trophy Points:
    0
    #10
    it's gonna take some to clear the google cache so don't worry about it. Just use the VIMF's code at #5. Though now totally necessary here but if you want you can use no-www wordpress plugin.
     
    poseidon, Sep 16, 2007 IP
  11. alcam

    alcam Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    I have been running for a while and I can't see a performance hit with removing wp-cache. (Just eyeballing it anyway.) I opted to include the www. Anyway, thanks for your response.

    I noted from the links on your signature line that you are not redirecting to the non-WWW site with your domains either.

    thanks again...
     
    alcam, Sep 25, 2007 IP