WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] SEO Friendly Redirect (3 posts)

  1. leMaxim
    Member
    Posted 8 years ago #

    By harnessing the power of Google I've discovered ways to resolve the www vs no-www issue out there. However, which way is (more) correct (than the others)?

    The simplest is:

    Redirect 301 / http://www.yoursite.com/
    (but it has variations like PermanentReidrect?)

    Then I found:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^YourSite\.com [nc]
    RewriteRule (.*) http://www.YourSite.com/$1 [R=301,L]

    What's the difference between this and the above?

    Which one of these is the standard (or which is better)?

    Thanks in advance.

  2. leMaxim
    Member
    Posted 8 years ago #

    bump

  3. Samuel Wood (Otto)
    Tech Ninja
    Posted 8 years ago #

    There is no actual difference between the two you posted. They have exactly the same effect and impact. The server will send identical responses in both cases (a 301 permanent redirect).

    However, the first requires that the server be running mod_alias, while the second requires mod_rewrite. Some servers have one, some have the other, some have both. If they have both, then the first one is slightly faster, in theory.

    So if the first one works, use that. If it doesn't seem to work, try the second one.

    If you're modifying things, be careful with the first one. Redirect directives can be trickier than they appear. Rewrite rules seem more complex, but they are at least explicit.

Topic Closed

This topic has been closed to new replies.

About this Topic