1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.4 Improve SEO - Redirection 301 to avoid duplicate content

Discussion in 'XenForo Questions and Support' started by Betclever, May 12, 2015.

  1. Betclever

    Betclever Active Member

    Hello all,

    How can I make a redirection to avoid duplicate content cause when I test my website with webrank, it tells me that I have to use a redirection to avoid duplicate content.

    In fact, I have access with www. or without www. so how can I redirect this please?

  2. Betclever

    Betclever Active Member

    I found a like on xenforo and added this:

    I just removed 3 things like test, tera-tweet and wiki but I got a question:

    If "allow" is empty, is my content indexed or shall I add something?
    In fact, I don't want to loose the indexation so when I see Disallow for forums and posts, what will happen then if it stays like on the list?

  3. popowich

    popowich Active Member

    The robots.txt above isn't for fixing your site working as both www and non-www

    This is what you want in your .htaccess to force the www version of your site

    # Force the site to www
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.example\.com$
    RewriteRule (.*) http://www.example.com/$1 [L,R=301]
    # end force site to www

    You'll need to replace exmaple.com with your domain name
  4. Betclever

    Betclever Active Member

    Yes, I'm sorry, wrong thread. :)

    I added your code but nothing changed.

    I think, I'm using the second one so bet-clever.com but the www. version works too.

    Please find my htaccess:

    You see on the bottom of the code that I added your code but changed to the url of my forum but the rule doesn't work so when I go to http://bet-clever.com, it doesn't redirect to http://www.bet-clever.com

    What's wrong?

    PS: I'm using shorter URL by Waindigo and rewrite rules under the CP.
  5. Betclever

    Betclever Active Member

  6. Mike

    Mike XenForo Developer Staff Member

    You need to move the code you've added to .htaccess up, likely at the top. That said, you've added a ton of code that I can't say I'd really recommend adding unless you understand what it's doing.
  7. Betclever

    Betclever Active Member

    Hello Mike, thanks for the suggestion.
    In fact, I found this code on this forum where it explains that this code is necessary to add some expire dates on elements but I don't remember which ones cause it's a while I have added this code... :)

    Of course, if you are able and if you have few minutes to tell me that this code is unnecessary, it will be sympa from your part so I can remove some of them.

    It works for the redirection. Super :)

Share This Page